@livestore/react 0.0.0-snapshot-8d3edf87cb1e88c7b67c5f3ea9d0b307253c33df
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/LiveStoreContext.d.ts +7 -0
- package/dist/LiveStoreContext.d.ts.map +1 -0
- package/dist/LiveStoreContext.js +13 -0
- package/dist/LiveStoreContext.js.map +1 -0
- package/dist/LiveStoreProvider.d.ts +49 -0
- package/dist/LiveStoreProvider.d.ts.map +1 -0
- package/dist/LiveStoreProvider.js +168 -0
- package/dist/LiveStoreProvider.js.map +1 -0
- package/dist/LiveStoreProvider.test.d.ts +2 -0
- package/dist/LiveStoreProvider.test.d.ts.map +1 -0
- package/dist/LiveStoreProvider.test.js +62 -0
- package/dist/LiveStoreProvider.test.js.map +1 -0
- package/dist/__tests__/fixture.d.ts +567 -0
- package/dist/__tests__/fixture.d.ts.map +1 -0
- package/dist/__tests__/fixture.js +61 -0
- package/dist/__tests__/fixture.js.map +1 -0
- package/dist/experimental/components/LiveList.d.ts +21 -0
- package/dist/experimental/components/LiveList.d.ts.map +1 -0
- package/dist/experimental/components/LiveList.js +31 -0
- package/dist/experimental/components/LiveList.js.map +1 -0
- package/dist/experimental/mod.d.ts +2 -0
- package/dist/experimental/mod.d.ts.map +1 -0
- package/dist/experimental/mod.js +2 -0
- package/dist/experimental/mod.js.map +1 -0
- package/dist/mod.d.ts +8 -0
- package/dist/mod.d.ts.map +1 -0
- package/dist/mod.js +8 -0
- package/dist/mod.js.map +1 -0
- package/dist/useAtom.d.ts +10 -0
- package/dist/useAtom.d.ts.map +1 -0
- package/dist/useAtom.js +37 -0
- package/dist/useAtom.js.map +1 -0
- package/dist/useQuery.d.ts +9 -0
- package/dist/useQuery.d.ts.map +1 -0
- package/dist/useQuery.js +88 -0
- package/dist/useQuery.js.map +1 -0
- package/dist/useQuery.test.d.ts +2 -0
- package/dist/useQuery.test.d.ts.map +1 -0
- package/dist/useQuery.test.js +51 -0
- package/dist/useQuery.test.js.map +1 -0
- package/dist/useRow.d.ts +46 -0
- package/dist/useRow.d.ts.map +1 -0
- package/dist/useRow.js +96 -0
- package/dist/useRow.js.map +1 -0
- package/dist/useRow.test.d.ts +2 -0
- package/dist/useRow.test.d.ts.map +1 -0
- package/dist/useRow.test.js +212 -0
- package/dist/useRow.test.js.map +1 -0
- package/dist/useTemporaryQuery.d.ts +22 -0
- package/dist/useTemporaryQuery.d.ts.map +1 -0
- package/dist/useTemporaryQuery.js +75 -0
- package/dist/useTemporaryQuery.js.map +1 -0
- package/dist/useTemporaryQuery.test.d.ts +2 -0
- package/dist/useTemporaryQuery.test.d.ts.map +1 -0
- package/dist/useTemporaryQuery.test.js +59 -0
- package/dist/useTemporaryQuery.test.js.map +1 -0
- package/dist/utils/stack-info.d.ts +4 -0
- package/dist/utils/stack-info.d.ts.map +1 -0
- package/dist/utils/stack-info.js +11 -0
- package/dist/utils/stack-info.js.map +1 -0
- package/dist/utils/useStateRefWithReactiveInput.d.ts +13 -0
- package/dist/utils/useStateRefWithReactiveInput.d.ts.map +1 -0
- package/dist/utils/useStateRefWithReactiveInput.js +38 -0
- package/dist/utils/useStateRefWithReactiveInput.js.map +1 -0
- package/package.json +54 -0
- package/src/LiveStoreContext.ts +19 -0
- package/src/LiveStoreProvider.test.tsx +109 -0
- package/src/LiveStoreProvider.tsx +295 -0
- package/src/__snapshots__/useRow.test.tsx.snap +359 -0
- package/src/__tests__/fixture.tsx +119 -0
- package/src/ambient.d.ts +2 -0
- package/src/experimental/components/LiveList.tsx +84 -0
- package/src/experimental/mod.ts +1 -0
- package/src/mod.ts +13 -0
- package/src/useAtom.ts +55 -0
- package/src/useQuery.test.tsx +82 -0
- package/src/useQuery.ts +122 -0
- package/src/useRow.test.tsx +346 -0
- package/src/useRow.ts +182 -0
- package/src/useTemporaryQuery.test.tsx +98 -0
- package/src/useTemporaryQuery.ts +131 -0
- package/src/utils/stack-info.ts +13 -0
- package/src/utils/useStateRefWithReactiveInput.ts +51 -0
- package/tsconfig.json +20 -0
- package/vitest.config.js +17 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Store } from '@livestore/livestore';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const LiveStoreContext: React.Context<import("@livestore/livestore/src/store-context.js").LiveStoreContextRunning | undefined>;
|
|
4
|
+
export declare const useStore: () => {
|
|
5
|
+
store: Store;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=LiveStoreContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveStoreContext.d.ts","sourceRoot":"","sources":["../src/LiveStoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,eAAO,MAAM,gBAAgB,wGAAgE,CAAA;AAE7F,eAAO,MAAM,QAAQ,QAAO;IAAE,KAAK,EAAE,KAAK,CAAA;CAYzC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
export const LiveStoreContext = React.createContext(undefined);
|
|
3
|
+
export const useStore = () => {
|
|
4
|
+
const storeContext = useContext(LiveStoreContext);
|
|
5
|
+
if (storeContext === undefined) {
|
|
6
|
+
throw new Error(`useStore can only be used inside StoreContext.Provider`);
|
|
7
|
+
}
|
|
8
|
+
if (storeContext.stage !== 'running') {
|
|
9
|
+
throw new Error(`useStore can only be used after the store is running`);
|
|
10
|
+
}
|
|
11
|
+
return storeContext;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=LiveStoreContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveStoreContext.js","sourceRoot":"","sources":["../src/LiveStoreContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAgC,SAAS,CAAC,CAAA;AAE7F,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAqB,EAAE;IAC7C,MAAM,YAAY,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAEjD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;IAC3E,CAAC;IAED,IAAI,YAAY,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;IAED,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Adapter, BootDb, BootStatus, IntentionalShutdownCause } from '@livestore/common';
|
|
2
|
+
import { UnexpectedError } from '@livestore/common';
|
|
3
|
+
import type { LiveStoreSchema } from '@livestore/common/schema';
|
|
4
|
+
import type { BaseGraphQLContext, GraphQLOptions, OtelOptions } from '@livestore/livestore';
|
|
5
|
+
import { StoreAbort } from '@livestore/livestore';
|
|
6
|
+
import { Effect } from '@livestore/utils/effect';
|
|
7
|
+
import type * as otel from '@opentelemetry/api';
|
|
8
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
9
|
+
interface LiveStoreProviderProps<GraphQLContext> {
|
|
10
|
+
schema: LiveStoreSchema;
|
|
11
|
+
/**
|
|
12
|
+
* The `storeId` can be used to isolate multiple stores from each other.
|
|
13
|
+
* So it can be useful for multi-tenancy scenarios.
|
|
14
|
+
*
|
|
15
|
+
* The `storeId` is also used for persistence.
|
|
16
|
+
*
|
|
17
|
+
* Make sure to also provide `storeId` to `mountDevtools` in `_devtools.html`.
|
|
18
|
+
*
|
|
19
|
+
* @default 'default'
|
|
20
|
+
*/
|
|
21
|
+
storeId?: string;
|
|
22
|
+
boot?: (db: BootDb, parentSpan: otel.Span) => void | Promise<void> | Effect.Effect<void, unknown, otel.Tracer>;
|
|
23
|
+
graphQLOptions?: GraphQLOptions<GraphQLContext>;
|
|
24
|
+
otelOptions?: OtelOptions;
|
|
25
|
+
renderLoading: (status: BootStatus) => ReactElement;
|
|
26
|
+
renderError?: (error: UnexpectedError | unknown) => ReactElement;
|
|
27
|
+
renderShutdown?: (cause: IntentionalShutdownCause | StoreAbort) => ReactElement;
|
|
28
|
+
adapter: Adapter;
|
|
29
|
+
/**
|
|
30
|
+
* In order for LiveStore to apply multiple mutations in a single render,
|
|
31
|
+
* you need to pass the `batchUpdates` function from either `react-dom` or `react-native`.
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* // With React DOM
|
|
35
|
+
* import { unstable_batchedUpdates as batchUpdates } from 'react-dom'
|
|
36
|
+
*
|
|
37
|
+
* // With React Native
|
|
38
|
+
* import { unstable_batchedUpdates as batchUpdates } from 'react-native'
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
batchUpdates: (run: () => void) => void;
|
|
42
|
+
disableDevtools?: boolean;
|
|
43
|
+
signal?: AbortSignal;
|
|
44
|
+
}
|
|
45
|
+
export declare const LiveStoreProvider: <GraphQLContext extends BaseGraphQLContext>({ renderLoading, renderError, renderShutdown, graphQLOptions, otelOptions, children, schema, storeId, boot, adapter, batchUpdates, disableDevtools, signal, }: LiveStoreProviderProps<GraphQLContext> & {
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
}) => JSX.Element;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=LiveStoreProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveStoreProvider.d.ts","sourceRoot":"","sources":["../src/LiveStoreProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAC9F,OAA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,CAAA;CACrB;AAkBD,eAAO,MAAM,iBAAiB,GAAI,cAAc,SAAS,kBAAkB,iKAcxE,sBAAsB,CAAC,cAAc,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,KAAG,GAAG,CAAC,OA6B1E,CAAA"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { UnexpectedError } from '@livestore/common';
|
|
2
|
+
import { createStore, StoreAbort, StoreInterrupted } from '@livestore/livestore';
|
|
3
|
+
import { errorToString } from '@livestore/utils';
|
|
4
|
+
import { Effect, FiberSet, Logger, LogLevel, Schema } from '@livestore/utils/effect';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { LiveStoreContext } from './LiveStoreContext.js';
|
|
7
|
+
const defaultRenderError = (error) => (React.createElement(React.Fragment, null, Schema.is(UnexpectedError)(error) ? error.toString() : errorToString(error)));
|
|
8
|
+
const defaultRenderShutdown = (cause) => {
|
|
9
|
+
const reason = cause._tag === 'LiveStore.StoreAbort'
|
|
10
|
+
? 'abort signal'
|
|
11
|
+
: cause.reason === 'devtools-import'
|
|
12
|
+
? 'devtools import'
|
|
13
|
+
: cause.reason === 'devtools-reset'
|
|
14
|
+
? 'devtools reset'
|
|
15
|
+
: 'unknown reason';
|
|
16
|
+
return React.createElement(React.Fragment, null,
|
|
17
|
+
"LiveStore Shutdown due to ",
|
|
18
|
+
reason);
|
|
19
|
+
};
|
|
20
|
+
export const LiveStoreProvider = ({ renderLoading, renderError = defaultRenderError, renderShutdown = defaultRenderShutdown, graphQLOptions, otelOptions, children, schema, storeId = 'default', boot, adapter, batchUpdates, disableDevtools, signal, }) => {
|
|
21
|
+
const storeCtx = useCreateStore({
|
|
22
|
+
storeId,
|
|
23
|
+
schema,
|
|
24
|
+
graphQLOptions,
|
|
25
|
+
otelOptions,
|
|
26
|
+
boot,
|
|
27
|
+
adapter,
|
|
28
|
+
batchUpdates,
|
|
29
|
+
disableDevtools,
|
|
30
|
+
signal,
|
|
31
|
+
});
|
|
32
|
+
if (storeCtx.stage === 'error') {
|
|
33
|
+
return renderError(storeCtx.error);
|
|
34
|
+
}
|
|
35
|
+
if (storeCtx.stage === 'shutdown') {
|
|
36
|
+
return renderShutdown(storeCtx.cause);
|
|
37
|
+
}
|
|
38
|
+
if (storeCtx.stage !== 'running') {
|
|
39
|
+
return renderLoading(storeCtx);
|
|
40
|
+
}
|
|
41
|
+
globalThis.__debugLiveStore ??= {};
|
|
42
|
+
globalThis.__debugLiveStore[storeId] = storeCtx.store;
|
|
43
|
+
return React.createElement(LiveStoreContext.Provider, { value: storeCtx }, children);
|
|
44
|
+
};
|
|
45
|
+
const semaphoreMap = new Map();
|
|
46
|
+
const withSemaphore = (storeId) => {
|
|
47
|
+
let semaphore = semaphoreMap.get(storeId);
|
|
48
|
+
if (!semaphore) {
|
|
49
|
+
semaphore = Effect.makeSemaphore(1).pipe(Effect.runSync);
|
|
50
|
+
semaphoreMap.set(storeId, semaphore);
|
|
51
|
+
}
|
|
52
|
+
return semaphore.withPermits(1);
|
|
53
|
+
};
|
|
54
|
+
const useCreateStore = ({ schema, storeId, graphQLOptions, otelOptions, boot, adapter, batchUpdates, disableDevtools, reactivityGraph, signal, }) => {
|
|
55
|
+
const [_, rerender] = React.useState(0);
|
|
56
|
+
const ctxValueRef = React.useRef({
|
|
57
|
+
value: { stage: 'loading' },
|
|
58
|
+
fiberSet: undefined,
|
|
59
|
+
counter: 0,
|
|
60
|
+
});
|
|
61
|
+
// console.debug(`useCreateStore (${ctxValueRef.current.counter})`, ctxValueRef.current.value.stage)
|
|
62
|
+
const inputPropsCacheRef = React.useRef({
|
|
63
|
+
schema,
|
|
64
|
+
graphQLOptions,
|
|
65
|
+
otelOptions,
|
|
66
|
+
boot,
|
|
67
|
+
adapter,
|
|
68
|
+
batchUpdates,
|
|
69
|
+
disableDevtools,
|
|
70
|
+
reactivityGraph,
|
|
71
|
+
signal,
|
|
72
|
+
});
|
|
73
|
+
const interrupt = (fiberSet, error) => Effect.gen(function* () {
|
|
74
|
+
yield* FiberSet.clear(fiberSet);
|
|
75
|
+
yield* FiberSet.run(fiberSet, Effect.fail(error));
|
|
76
|
+
}).pipe(Effect.tapErrorCause((cause) => Effect.logDebug(`[@livestore/livestore/react] interupting`, cause)), Effect.runFork);
|
|
77
|
+
if (inputPropsCacheRef.current.schema !== schema ||
|
|
78
|
+
inputPropsCacheRef.current.graphQLOptions !== graphQLOptions ||
|
|
79
|
+
inputPropsCacheRef.current.otelOptions !== otelOptions ||
|
|
80
|
+
inputPropsCacheRef.current.boot !== boot ||
|
|
81
|
+
inputPropsCacheRef.current.adapter !== adapter ||
|
|
82
|
+
inputPropsCacheRef.current.batchUpdates !== batchUpdates ||
|
|
83
|
+
inputPropsCacheRef.current.disableDevtools !== disableDevtools ||
|
|
84
|
+
inputPropsCacheRef.current.reactivityGraph !== reactivityGraph ||
|
|
85
|
+
inputPropsCacheRef.current.signal !== signal) {
|
|
86
|
+
inputPropsCacheRef.current = {
|
|
87
|
+
schema,
|
|
88
|
+
graphQLOptions,
|
|
89
|
+
otelOptions,
|
|
90
|
+
boot,
|
|
91
|
+
adapter,
|
|
92
|
+
batchUpdates,
|
|
93
|
+
disableDevtools,
|
|
94
|
+
reactivityGraph,
|
|
95
|
+
signal,
|
|
96
|
+
};
|
|
97
|
+
if (ctxValueRef.current.fiberSet !== undefined) {
|
|
98
|
+
interrupt(ctxValueRef.current.fiberSet, new StoreInterrupted());
|
|
99
|
+
ctxValueRef.current.fiberSet = undefined;
|
|
100
|
+
}
|
|
101
|
+
ctxValueRef.current = { value: { stage: 'loading' }, fiberSet: undefined, counter: ctxValueRef.current.counter + 1 };
|
|
102
|
+
}
|
|
103
|
+
React.useEffect(() => {
|
|
104
|
+
const counter = ctxValueRef.current.counter;
|
|
105
|
+
const setContextValue = (value) => {
|
|
106
|
+
if (ctxValueRef.current.counter !== counter)
|
|
107
|
+
return;
|
|
108
|
+
ctxValueRef.current.value = value;
|
|
109
|
+
rerender((c) => c + 1);
|
|
110
|
+
};
|
|
111
|
+
signal?.addEventListener('abort', () => {
|
|
112
|
+
if (ctxValueRef.current.fiberSet !== undefined && ctxValueRef.current.counter === counter) {
|
|
113
|
+
interrupt(ctxValueRef.current.fiberSet, new StoreAbort());
|
|
114
|
+
ctxValueRef.current.fiberSet = undefined;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
Effect.gen(function* () {
|
|
118
|
+
const fiberSet = yield* FiberSet.make();
|
|
119
|
+
ctxValueRef.current.fiberSet = fiberSet;
|
|
120
|
+
yield* Effect.gen(function* () {
|
|
121
|
+
const store = yield* createStore({
|
|
122
|
+
fiberSet,
|
|
123
|
+
schema,
|
|
124
|
+
storeId,
|
|
125
|
+
graphQLOptions,
|
|
126
|
+
otelOptions,
|
|
127
|
+
boot,
|
|
128
|
+
adapter,
|
|
129
|
+
reactivityGraph,
|
|
130
|
+
batchUpdates,
|
|
131
|
+
disableDevtools,
|
|
132
|
+
onBootStatus: (status) => {
|
|
133
|
+
if (ctxValueRef.current.value.stage === 'running' || ctxValueRef.current.value.stage === 'error')
|
|
134
|
+
return;
|
|
135
|
+
setContextValue(status);
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
setContextValue({ stage: 'running', store });
|
|
139
|
+
yield* Effect.never;
|
|
140
|
+
}).pipe(Effect.scoped, FiberSet.run(fiberSet));
|
|
141
|
+
const shutdownContext = (cause) => Effect.sync(() => setContextValue({ stage: 'shutdown', cause }));
|
|
142
|
+
yield* FiberSet.join(fiberSet).pipe(Effect.catchTag('LiveStore.IntentionalShutdownCause', (cause) => shutdownContext(cause)), Effect.catchTag('LiveStore.StoreAbort', (cause) => shutdownContext(cause)), Effect.tapError((error) => Effect.sync(() => setContextValue({ stage: 'error', error }))), Effect.tapDefect((defect) => Effect.sync(() => setContextValue({ stage: 'error', error: defect }))), Effect.exit);
|
|
143
|
+
}).pipe(Effect.scoped,
|
|
144
|
+
// NOTE we're running the code above in a semaphore to make sure a previous store is always fully
|
|
145
|
+
// shutdown before a new one is created - especially when shutdown logic is async. You can't trust `React.useEffect`.
|
|
146
|
+
// Thank you to Mattia Manzati for this idea.
|
|
147
|
+
withSemaphore(storeId), Effect.tapCauseLogPretty, Effect.annotateLogs({ thread: 'window' }), Effect.provide(Logger.pretty), Logger.withMinimumLogLevel(LogLevel.Debug), Effect.runFork);
|
|
148
|
+
return () => {
|
|
149
|
+
if (ctxValueRef.current.fiberSet !== undefined) {
|
|
150
|
+
interrupt(ctxValueRef.current.fiberSet, new StoreInterrupted());
|
|
151
|
+
ctxValueRef.current.fiberSet = undefined;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}, [
|
|
155
|
+
schema,
|
|
156
|
+
graphQLOptions,
|
|
157
|
+
otelOptions,
|
|
158
|
+
boot,
|
|
159
|
+
adapter,
|
|
160
|
+
batchUpdates,
|
|
161
|
+
disableDevtools,
|
|
162
|
+
signal,
|
|
163
|
+
reactivityGraph,
|
|
164
|
+
storeId,
|
|
165
|
+
]);
|
|
166
|
+
return ctxValueRef.current.value;
|
|
167
|
+
};
|
|
168
|
+
//# sourceMappingURL=LiveStoreProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveStoreProvider.js","sourceRoot":"","sources":["../src/LiveStoreProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AASnD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAGpF,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAuCxD,MAAM,kBAAkB,GAAG,CAAC,KAAgC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O,WAAW,CAAC,OAAO,CAAC,KAAK,CAAA;AAClC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveStoreProvider.test.d.ts","sourceRoot":"","sources":["../src/LiveStoreProvider.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { sql } from '@livestore/common';
|
|
2
|
+
import { querySQL } from '@livestore/livestore';
|
|
3
|
+
import { Schema } from '@livestore/utils/effect';
|
|
4
|
+
import { makeInMemoryAdapter } from '@livestore/web';
|
|
5
|
+
import { render, screen, waitFor, waitForElementToBeRemoved } from '@testing-library/react';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { unstable_batchedUpdates as batchUpdates } from 'react-dom';
|
|
8
|
+
import { describe, expect, it } from 'vitest';
|
|
9
|
+
import { schema, tables } from './__tests__/fixture.js';
|
|
10
|
+
import { LiveStoreProvider } from './LiveStoreProvider.js';
|
|
11
|
+
import * as LiveStoreReact from './mod.js';
|
|
12
|
+
describe('LiveStoreProvider', () => {
|
|
13
|
+
it('simple', async () => {
|
|
14
|
+
let appRenderCount = 0;
|
|
15
|
+
const allTodos$ = querySQL(`select * from todos`, { schema: Schema.Array(tables.todos.schema) });
|
|
16
|
+
const App = () => {
|
|
17
|
+
appRenderCount++;
|
|
18
|
+
const todos = LiveStoreReact.useQuery(allTodos$);
|
|
19
|
+
return React.createElement("div", null, JSON.stringify(todos));
|
|
20
|
+
};
|
|
21
|
+
const abortController = new AbortController();
|
|
22
|
+
const Root = ({ forceUpdate }) => {
|
|
23
|
+
const bootCb = React.useCallback((db) => db.execute(sql `INSERT OR IGNORE INTO todos (id, text, completed) VALUES ('t1', 'buy milk', 0);`), []);
|
|
24
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
|
+
const adapterMemo = React.useMemo(() => makeInMemoryAdapter(), [forceUpdate]);
|
|
26
|
+
return (React.createElement(LiveStoreProvider, { schema: schema, renderLoading: (status) => React.createElement("div", null,
|
|
27
|
+
"Loading LiveStore: ",
|
|
28
|
+
status.stage), adapter: adapterMemo, boot: bootCb, signal: abortController.signal, batchUpdates: batchUpdates },
|
|
29
|
+
React.createElement(App, null)));
|
|
30
|
+
};
|
|
31
|
+
const { rerender } = render(React.createElement(Root, { forceUpdate: 1 }));
|
|
32
|
+
expect(appRenderCount).toBe(0);
|
|
33
|
+
await waitForElementToBeRemoved(() => screen.getByText((_) => _.startsWith('Loading LiveStore')));
|
|
34
|
+
expect(appRenderCount).toBe(1);
|
|
35
|
+
rerender(React.createElement(Root, { forceUpdate: 2 }));
|
|
36
|
+
await waitFor(() => screen.getByText('Loading LiveStore: loading'));
|
|
37
|
+
await waitFor(() => screen.getByText((_) => _.includes('buy milk')));
|
|
38
|
+
expect(appRenderCount).toBe(2);
|
|
39
|
+
abortController.abort();
|
|
40
|
+
await waitFor(() => screen.getByText('LiveStore Shutdown due to abort signal'));
|
|
41
|
+
});
|
|
42
|
+
it('error during boot', async () => {
|
|
43
|
+
let appRenderCount = 0;
|
|
44
|
+
const App = () => {
|
|
45
|
+
appRenderCount++;
|
|
46
|
+
return React.createElement("div", null, "hello world");
|
|
47
|
+
};
|
|
48
|
+
const Root = ({ forceUpdate }) => {
|
|
49
|
+
const bootCb = React.useCallback((db) => db.execute(sql `INSERT INTO todos_mising_table (id, text, completed) VALUES ('t1', 'buy milk', 0);`), []);
|
|
50
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
|
+
const adapterMemo = React.useMemo(() => makeInMemoryAdapter(), [forceUpdate]);
|
|
52
|
+
return (React.createElement(LiveStoreProvider, { schema: schema, renderLoading: (status) => React.createElement("div", null,
|
|
53
|
+
"Loading LiveStore: ",
|
|
54
|
+
status.stage), adapter: adapterMemo, boot: bootCb, batchUpdates: batchUpdates },
|
|
55
|
+
React.createElement(App, null)));
|
|
56
|
+
};
|
|
57
|
+
render(React.createElement(Root, { forceUpdate: 1 }));
|
|
58
|
+
expect(appRenderCount).toBe(0);
|
|
59
|
+
await waitFor(() => screen.getByText((_) => _.startsWith('LiveStore.UnexpectedError')));
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=LiveStoreProvider.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveStoreProvider.test.js","sourceRoot":"","sources":["../src/LiveStoreProvider.test.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAC3F,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,uBAAuB,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,cAAc,MAAM,UAAU,CAAA;AAE1C,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;QACtB,IAAI,cAAc,GAAG,CAAC,CAAA;QAEtB,MAAM,SAAS,GAAG,QAAQ,CAAC,qBAAqB,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QAEhG,MAAM,GAAG,GAAG,GAAG,EAAE;YACf,cAAc,EAAE,CAAA;Y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