@livestore/react 0.3.0-dev.19 → 0.3.0-dev.22
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/dist/.tsbuildinfo +1 -1
- package/dist/LiveStoreProvider.d.ts +11 -6
- package/dist/LiveStoreProvider.d.ts.map +1 -1
- package/dist/LiveStoreProvider.js +29 -9
- package/dist/LiveStoreProvider.js.map +1 -1
- package/dist/__tests__/fixture.d.ts +2 -2
- package/dist/useAtom.d.ts +4 -3
- package/dist/useAtom.d.ts.map +1 -1
- package/dist/useAtom.js.map +1 -1
- package/dist/useQuery.d.ts +8 -7
- package/dist/useQuery.d.ts.map +1 -1
- package/dist/useQuery.js.map +1 -1
- package/package.json +12 -11
- package/src/LiveStoreProvider.tsx +44 -18
- package/src/useAtom.ts +8 -4
- package/src/useQuery.ts +10 -9
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Adapter, BootStatus, IntentionalShutdownCause, MigrationsReport } from '@livestore/common';
|
|
2
2
|
import { UnexpectedError } from '@livestore/common';
|
|
3
3
|
import type { LiveStoreSchema } from '@livestore/common/schema';
|
|
4
|
-
import type {
|
|
4
|
+
import type { OtelOptions, Store } from '@livestore/livestore';
|
|
5
5
|
import { StoreInterrupted } from '@livestore/livestore';
|
|
6
6
|
import type { OtelTracer } from '@livestore/utils/effect';
|
|
7
7
|
import { Effect } from '@livestore/utils/effect';
|
|
8
8
|
import type * as otel from '@opentelemetry/api';
|
|
9
9
|
import type { ReactElement, ReactNode } from 'react';
|
|
10
10
|
import React from 'react';
|
|
11
|
-
interface LiveStoreProviderProps
|
|
11
|
+
export interface LiveStoreProviderProps {
|
|
12
12
|
schema: LiveStoreSchema;
|
|
13
13
|
/**
|
|
14
14
|
* The `storeId` can be used to isolate multiple stores from each other.
|
|
@@ -21,11 +21,10 @@ interface LiveStoreProviderProps<GraphQLContext extends BaseGraphQLContext> {
|
|
|
21
21
|
* @default 'default'
|
|
22
22
|
*/
|
|
23
23
|
storeId?: string;
|
|
24
|
-
boot?: (store: Store<
|
|
24
|
+
boot?: (store: Store<LiveStoreSchema>, ctx: {
|
|
25
25
|
migrationsReport: MigrationsReport;
|
|
26
26
|
parentSpan: otel.Span;
|
|
27
27
|
}) => void | Promise<void> | Effect.Effect<void, unknown, OtelTracer.OtelTracer>;
|
|
28
|
-
graphQLOptions?: GraphQLOptions<GraphQLContext>;
|
|
29
28
|
otelOptions?: Partial<OtelOptions>;
|
|
30
29
|
renderLoading: (status: BootStatus) => ReactElement;
|
|
31
30
|
renderError?: (error: UnexpectedError | unknown) => ReactElement;
|
|
@@ -46,9 +45,15 @@ interface LiveStoreProviderProps<GraphQLContext extends BaseGraphQLContext> {
|
|
|
46
45
|
batchUpdates: (run: () => void) => void;
|
|
47
46
|
disableDevtools?: boolean;
|
|
48
47
|
signal?: AbortSignal;
|
|
48
|
+
/**
|
|
49
|
+
* Currently only used in the web adapter:
|
|
50
|
+
* If true, registers a beforeunload event listener to confirm unsaved changes.
|
|
51
|
+
*
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
54
|
+
confirmUnsavedChanges?: boolean;
|
|
49
55
|
}
|
|
50
|
-
export declare const LiveStoreProvider:
|
|
56
|
+
export declare const LiveStoreProvider: ({ renderLoading, renderError, renderShutdown, otelOptions, children, schema, storeId, boot, adapter, batchUpdates, disableDevtools, signal, confirmUnsavedChanges, }: LiveStoreProviderProps & {
|
|
51
57
|
children?: ReactNode;
|
|
52
58
|
}) => React.ReactElement;
|
|
53
|
-
export {};
|
|
54
59
|
//# sourceMappingURL=LiveStoreProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveStoreProvider.d.ts","sourceRoot":"","sources":["../src/LiveStoreProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACxG,OAAO,EAAe,eAAe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WAAW,CAAC,CAAA;IAClC,aAAa,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,YAAY,CAAA;IACnD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,KAAK,YAAY,CAAA;IAChE,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,wBAAwB,GAAG,gBAAgB,KAAK,YAAY,CAAA;IACrF,OAAO,EAAE,OAAO,CAAA;IAChB;;;;;;;;;;;OAWG;IACH,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;IACvC,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC;AAoBD,eAAO,MAAM,iBAAiB,GAAI,sKAc/B,sBAAsB,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,KAAG,KAAK,CAAC,YAgC5D,CAAA"}
|
|
@@ -19,17 +19,17 @@ const defaultRenderShutdown = (cause) => {
|
|
|
19
19
|
"LiveStore Shutdown due to ",
|
|
20
20
|
reason);
|
|
21
21
|
};
|
|
22
|
-
export const LiveStoreProvider = ({ renderLoading, renderError = defaultRenderError, renderShutdown = defaultRenderShutdown,
|
|
22
|
+
export const LiveStoreProvider = ({ renderLoading, renderError = defaultRenderError, renderShutdown = defaultRenderShutdown, otelOptions, children, schema, storeId = 'default', boot, adapter, batchUpdates, disableDevtools, signal, confirmUnsavedChanges = true, }) => {
|
|
23
23
|
const storeCtx = useCreateStore({
|
|
24
24
|
storeId,
|
|
25
25
|
schema,
|
|
26
|
-
graphQLOptions,
|
|
27
26
|
otelOptions,
|
|
28
27
|
boot,
|
|
29
28
|
adapter,
|
|
30
29
|
batchUpdates,
|
|
31
30
|
disableDevtools,
|
|
32
31
|
signal,
|
|
32
|
+
confirmUnsavedChanges,
|
|
33
33
|
});
|
|
34
34
|
if (storeCtx.stage === 'error') {
|
|
35
35
|
return renderError(storeCtx.error);
|
|
@@ -56,7 +56,7 @@ const withSemaphore = (storeId) => {
|
|
|
56
56
|
}
|
|
57
57
|
return semaphore.withPermits(1);
|
|
58
58
|
};
|
|
59
|
-
const useCreateStore = ({ schema, storeId,
|
|
59
|
+
const useCreateStore = ({ schema, storeId, otelOptions, boot, adapter, batchUpdates, disableDevtools, signal, context, params, confirmUnsavedChanges, }) => {
|
|
60
60
|
const [_, rerender] = React.useState(0);
|
|
61
61
|
const ctxValueRef = React.useRef({
|
|
62
62
|
value: { stage: 'loading' },
|
|
@@ -67,13 +67,15 @@ const useCreateStore = ({ schema, storeId, graphQLOptions, otelOptions, boot, ad
|
|
|
67
67
|
// console.debug(`useCreateStore (${ctxValueRef.current.counter})`, ctxValueRef.current.value.stage)
|
|
68
68
|
const inputPropsCacheRef = React.useRef({
|
|
69
69
|
schema,
|
|
70
|
-
graphQLOptions,
|
|
71
70
|
otelOptions,
|
|
72
71
|
boot,
|
|
73
72
|
adapter,
|
|
74
73
|
batchUpdates,
|
|
75
74
|
disableDevtools,
|
|
76
75
|
signal,
|
|
76
|
+
context,
|
|
77
|
+
params,
|
|
78
|
+
confirmUnsavedChanges,
|
|
77
79
|
});
|
|
78
80
|
const interrupt = (componentScope, shutdownDeferred, error) => Effect.gen(function* () {
|
|
79
81
|
// console.log('[@livestore/livestore/react] interupting', error)
|
|
@@ -81,22 +83,26 @@ const useCreateStore = ({ schema, storeId, graphQLOptions, otelOptions, boot, ad
|
|
|
81
83
|
yield* Deferred.fail(shutdownDeferred, error);
|
|
82
84
|
}).pipe(Effect.tapErrorCause((cause) => Effect.logDebug('[@livestore/livestore/react] interupting', cause)), Effect.runFork);
|
|
83
85
|
if (inputPropsCacheRef.current.schema !== schema ||
|
|
84
|
-
inputPropsCacheRef.current.graphQLOptions !== graphQLOptions ||
|
|
85
86
|
inputPropsCacheRef.current.otelOptions !== otelOptions ||
|
|
86
87
|
inputPropsCacheRef.current.boot !== boot ||
|
|
87
88
|
inputPropsCacheRef.current.adapter !== adapter ||
|
|
88
89
|
inputPropsCacheRef.current.batchUpdates !== batchUpdates ||
|
|
89
90
|
inputPropsCacheRef.current.disableDevtools !== disableDevtools ||
|
|
90
|
-
inputPropsCacheRef.current.signal !== signal
|
|
91
|
+
inputPropsCacheRef.current.signal !== signal ||
|
|
92
|
+
inputPropsCacheRef.current.context !== context ||
|
|
93
|
+
inputPropsCacheRef.current.params !== params ||
|
|
94
|
+
inputPropsCacheRef.current.confirmUnsavedChanges !== confirmUnsavedChanges) {
|
|
91
95
|
inputPropsCacheRef.current = {
|
|
92
96
|
schema,
|
|
93
|
-
graphQLOptions,
|
|
94
97
|
otelOptions,
|
|
95
98
|
boot,
|
|
96
99
|
adapter,
|
|
97
100
|
batchUpdates,
|
|
98
101
|
disableDevtools,
|
|
99
102
|
signal,
|
|
103
|
+
context,
|
|
104
|
+
params,
|
|
105
|
+
confirmUnsavedChanges,
|
|
100
106
|
};
|
|
101
107
|
if (ctxValueRef.current.componentScope !== undefined && ctxValueRef.current.shutdownDeferred !== undefined) {
|
|
102
108
|
interrupt(ctxValueRef.current.componentScope, ctxValueRef.current.shutdownDeferred, new StoreInterrupted({ reason: 're-rendering due to changed input props' }));
|
|
@@ -136,12 +142,14 @@ const useCreateStore = ({ schema, storeId, graphQLOptions, otelOptions, boot, ad
|
|
|
136
142
|
const store = yield* createStore({
|
|
137
143
|
schema,
|
|
138
144
|
storeId,
|
|
139
|
-
graphQLOptions,
|
|
140
145
|
boot,
|
|
141
146
|
adapter,
|
|
142
147
|
batchUpdates,
|
|
143
148
|
disableDevtools,
|
|
144
149
|
shutdownDeferred,
|
|
150
|
+
context,
|
|
151
|
+
params,
|
|
152
|
+
confirmUnsavedChanges,
|
|
145
153
|
onBootStatus: (status) => {
|
|
146
154
|
if (ctxValueRef.current.value.stage === 'running' || ctxValueRef.current.value.stage === 'error')
|
|
147
155
|
return;
|
|
@@ -165,7 +173,19 @@ const useCreateStore = ({ schema, storeId, graphQLOptions, otelOptions, boot, ad
|
|
|
165
173
|
ctxValueRef.current.shutdownDeferred = undefined;
|
|
166
174
|
}
|
|
167
175
|
};
|
|
168
|
-
}, [
|
|
176
|
+
}, [
|
|
177
|
+
schema,
|
|
178
|
+
otelOptions,
|
|
179
|
+
boot,
|
|
180
|
+
adapter,
|
|
181
|
+
batchUpdates,
|
|
182
|
+
disableDevtools,
|
|
183
|
+
signal,
|
|
184
|
+
storeId,
|
|
185
|
+
context,
|
|
186
|
+
params,
|
|
187
|
+
confirmUnsavedChanges,
|
|
188
|
+
]);
|
|
169
189
|
return ctxValueRef.current.value;
|
|
170
190
|
};
|
|
171
191
|
//# sourceMappingURL=LiveStoreProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveStoreProvider.js","sourceRoot":"","sources":["../src/LiveStoreProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"LiveStoreProvider.js","sourceRoot":"","sources":["../src/LiveStoreProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAShE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAExD,OAAO,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,WAAW,GACZ,MAAM,yBAAyB,CAAA;AAGhC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAgDxD,MAAM,kBAAkB,GAAG,CAAC,KAAgC,EAAE,EAAE,CAAC,CAC/D,0CAAG,MAAM,CAAC,EAAE,CA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AAS,EAAE,CAAC;gBAC3G,SAAS,CACP,WAAW,CAAC,OAAO,CAAC,cAAc,EAClC,WAAW,CAAC,OAAO,CAAC,gBAAgB,EACpC,IAAI,gBAAgB,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC,CACzD,CAAA;gBACD,WAAW,CAAC,OAAO,CAAC,cAAc,GAAG,SAAS,CAAA;gBAC9C,WAAW,CAAC,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAA;YAClD,CAAC;QACH,CAAC,CAAA;IACH,CAAC,EAAE;QACD,MAAM;QACN,WAAW;QACX,IAAI;QACJ,OAAO;QACP,YAAY;QACZ,eAAe;QACf,MAAM;QACN,OAAO;QACP,OAAO;QACP,MAAM;QACN,qBAAqB;KACtB,CAAC,CAAA;IAEF,OAAO,WAAW,CAAC,OAAO,CAAC,KAAK,CAAA;AAClC,CAAC,CAAA"}
|
|
@@ -492,7 +492,7 @@ export declare const makeTodoMvcReact: ({ otelTracer, otelContext, strictMode, }
|
|
|
492
492
|
strictMode?: boolean;
|
|
493
493
|
}) => Effect.Effect<{
|
|
494
494
|
wrapper: ({ children }: any) => React.JSX.Element;
|
|
495
|
-
store: import("@livestore/livestore/src/
|
|
495
|
+
store: import("@livestore/livestore/src/mod.js").Store<import("@livestore/common/schema").FromInputSchema.DeriveSchema<{
|
|
496
496
|
tables: {
|
|
497
497
|
todos: DbSchema.TableDef<{
|
|
498
498
|
name: "todos";
|
|
@@ -651,7 +651,7 @@ export declare const makeTodoMvcReact: ({ otelTracer, otelContext, strictMode, }
|
|
|
651
651
|
readonly id: "singleton";
|
|
652
652
|
}, never>>;
|
|
653
653
|
};
|
|
654
|
-
}
|
|
654
|
+
}>, {}>;
|
|
655
655
|
renderCount: {
|
|
656
656
|
readonly val: number;
|
|
657
657
|
inc: () => void;
|
package/dist/useAtom.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { QueryInfo } from '@livestore/common';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Store } from '@livestore/livestore';
|
|
3
|
+
import type { LiveQueries } from '@livestore/livestore/internal';
|
|
3
4
|
import type { Dispatch, SetStateAction } from './useRow.js';
|
|
4
|
-
export declare const useAtom: <TQuery extends LiveQueryDef<any, QueryInfo.Row | QueryInfo.Col>>(queryDef: TQuery, options?: {
|
|
5
|
+
export declare const useAtom: <TQuery extends LiveQueries.LiveQueryDef<any, QueryInfo.Row | QueryInfo.Col>>(queryDef: TQuery, options?: {
|
|
5
6
|
store?: Store;
|
|
6
|
-
}) => [value: GetResult<TQuery>, setValue: Dispatch<SetStateAction<Partial<GetResult<TQuery>>>>];
|
|
7
|
+
}) => [value: LiveQueries.GetResult<TQuery>, setValue: Dispatch<SetStateAction<Partial<LiveQueries.GetResult<TQuery>>>>];
|
|
7
8
|
//# sourceMappingURL=useAtom.d.ts.map
|
package/dist/useAtom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAtom.d.ts","sourceRoot":"","sources":["../src/useAtom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4B,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE5E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"useAtom.d.ts","sourceRoot":"","sources":["../src/useAtom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4B,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAMhE,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE3D,eAAO,MAAM,OAAO,GAElB,MAAM,SAAS,WAAW,CAAC,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,EAE3E,UAAU,MAAM,EAChB,UAAU;IACR,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,KACA,CACD,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,EACpC,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CA4C3E,CAAA"}
|
package/dist/useAtom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAtom.js","sourceRoot":"","sources":["../src/useAtom.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAtom.js","sourceRoot":"","sources":["../src/useAtom.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C,MAAM,CAAC,MAAM,OAAO,GAAG,CAIrB,QAAgB,EAChB,OAEC,EAID,EAAE;IACF,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAA;IACjE,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAA;IAExC,iCAAiC;IACjC,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACrC,iBAAiB,CAAC,kDAAkD,EAAE,QAAQ,CAAC,CAAA;IACjF,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE5B,qCAAqC;IACrC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAC5B,GAAG,EAAE,CAAC,CAAC,YAAiB,EAAE,EAAE;QAC1B,MAAM,QAAQ,GAAG,OAAO,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,Q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AS,CAAC,EAAE,EAAE;oBAClC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE;iBAChD,CAAC,CACH,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC,EACD,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,CAC7C,CAAA;IAED,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;AAC9C,CAAC,CAAA"}
|
package/dist/useQuery.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LiveQuery, LiveQueryDef, Store } from '@livestore/livestore';
|
|
2
|
+
import type { LiveQueries } from '@livestore/livestore/internal';
|
|
2
3
|
import * as otel from '@opentelemetry/api';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
/**
|
|
@@ -12,21 +13,21 @@ import React from 'react';
|
|
|
12
13
|
* }
|
|
13
14
|
* ```
|
|
14
15
|
*/
|
|
15
|
-
export declare const useQuery: <TQuery extends
|
|
16
|
+
export declare const useQuery: <TQuery extends LiveQueryDef.Any>(queryDef: TQuery, options?: {
|
|
16
17
|
store?: Store;
|
|
17
|
-
}) => GetResult<TQuery>;
|
|
18
|
-
type GetQueryInfo<TQuery extends
|
|
18
|
+
}) => LiveQueries.GetResult<TQuery>;
|
|
19
|
+
type GetQueryInfo<TQuery extends LiveQueryDef.Any> = TQuery extends LiveQueryDef<infer _1, infer TQueryInfo> ? TQueryInfo : never;
|
|
19
20
|
/**
|
|
20
21
|
*/
|
|
21
|
-
export declare const useQueryRef: <TQuery extends
|
|
22
|
+
export declare const useQueryRef: <TQuery extends LiveQueryDef.Any>(queryDef: TQuery, options?: {
|
|
22
23
|
store?: Store;
|
|
23
24
|
/** Parent otel context for the query */
|
|
24
25
|
otelContext?: otel.Context;
|
|
25
26
|
/** The name of the span to use for the query */
|
|
26
27
|
otelSpanName?: string;
|
|
27
28
|
}) => {
|
|
28
|
-
valueRef: React.RefObject<GetResult<TQuery>>;
|
|
29
|
-
queryRcRef: RcRef<LiveQuery<GetResult<TQuery>, GetQueryInfo<TQuery>>>;
|
|
29
|
+
valueRef: React.RefObject<LiveQueries.GetResult<TQuery>>;
|
|
30
|
+
queryRcRef: LiveQueries.RcRef<LiveQuery<LiveQueries.GetResult<TQuery>, GetQueryInfo<TQuery>>>;
|
|
30
31
|
};
|
|
31
32
|
export {};
|
|
32
33
|
//# sourceMappingURL=useQuery.d.ts.map
|
package/dist/useQuery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useQuery.d.ts","sourceRoot":"","sources":["../src/useQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"useQuery.d.ts","sourceRoot":"","sources":["../src/useQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAE1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAEhE,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,GAAI,MAAM,SAAS,YAAY,CAAC,GAAG,EACtD,UAAU,MAAM,EAChB,UAAU;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,KAC1B,WAAW,CAAC,SAAS,CAAC,MAAM,CAAoD,CAAA;AAEnF,KAAK,YAAY,CAAC,MAAM,SAAS,YAAY,CAAC,GAAG,IAC/C,MAAM,SAAS,YAAY,CAAC,MAAM,EAAE,EAAE,MAAM,UAAU,CAAC,GAAG,UAAU,GAAG,KAAK,CAAA;AAE9E;GACG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,SAAS,YAAY,CAAC,GAAG,EACzD,UAAU,MAAM,EAChB,UAAU;IACR,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,wCAAwC;IACxC,WAAW,CAAC,EAAE,IAAI,CAAC,OAAO,CAAA;IAC1B,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,KACA;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;IACxD,UAAU,EAAE,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;CAgH9F,CAAA"}
|
package/dist/useQuery.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useQuery.js","sourceRoot":"","sources":["../src/useQuery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"useQuery.js","sourceRoot":"","sources":["../src/useQuery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAExF,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAA;AAEtF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,QAAgB,EAChB,OAA2B,EACI,E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
+
"version": "0.3.0-dev.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": {
|
|
@@ -23,23 +23,24 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@opentelemetry/api": "1.9.0",
|
|
26
|
-
"@livestore/common": "0.3.0-dev.
|
|
27
|
-
"@livestore/
|
|
28
|
-
"@livestore/
|
|
26
|
+
"@livestore/common": "0.3.0-dev.22",
|
|
27
|
+
"@livestore/utils": "0.3.0-dev.22",
|
|
28
|
+
"@livestore/livestore": "0.3.0-dev.22"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@opentelemetry/sdk-trace-base": "^1.30.1",
|
|
32
|
-
"@testing-library/
|
|
33
|
-
"@
|
|
34
|
-
"@types/react
|
|
32
|
+
"@testing-library/dom": "^10.4.0",
|
|
33
|
+
"@testing-library/react": "^16.2.0",
|
|
34
|
+
"@types/react": "^19.0.10",
|
|
35
|
+
"@types/react-dom": "^19.0.4",
|
|
35
36
|
"jsdom": "^26.0.0",
|
|
36
37
|
"react": "^19.0.0",
|
|
37
38
|
"react-dom": "^19.0.0",
|
|
38
39
|
"react-window": "^1.8.11",
|
|
39
|
-
"typescript": "^5.
|
|
40
|
-
"vite": "^6.1
|
|
41
|
-
"vitest": "^
|
|
42
|
-
"@livestore/adapter-web": "0.3.0-dev.
|
|
40
|
+
"typescript": "^5.8.2",
|
|
41
|
+
"vite": "^6.2.1",
|
|
42
|
+
"vitest": "^3.0.8",
|
|
43
|
+
"@livestore/adapter-web": "0.3.0-dev.22"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
46
|
"react": "~19.0.0"
|
|
@@ -2,9 +2,7 @@ import type { Adapter, BootStatus, IntentionalShutdownCause, MigrationsReport }
|
|
|
2
2
|
import { provideOtel, UnexpectedError } from '@livestore/common'
|
|
3
3
|
import type { LiveStoreSchema } from '@livestore/common/schema'
|
|
4
4
|
import type {
|
|
5
|
-
BaseGraphQLContext,
|
|
6
5
|
CreateStoreOptions,
|
|
7
|
-
GraphQLOptions,
|
|
8
6
|
LiveStoreContext as StoreContext_,
|
|
9
7
|
OtelOptions,
|
|
10
8
|
ShutdownDeferred,
|
|
@@ -31,7 +29,7 @@ import React from 'react'
|
|
|
31
29
|
|
|
32
30
|
import { LiveStoreContext } from './LiveStoreContext.js'
|
|
33
31
|
|
|
34
|
-
interface LiveStoreProviderProps
|
|
32
|
+
export interface LiveStoreProviderProps {
|
|
35
33
|
schema: LiveStoreSchema
|
|
36
34
|
/**
|
|
37
35
|
* The `storeId` can be used to isolate multiple stores from each other.
|
|
@@ -45,10 +43,9 @@ interface LiveStoreProviderProps<GraphQLContext extends BaseGraphQLContext> {
|
|
|
45
43
|
*/
|
|
46
44
|
storeId?: string
|
|
47
45
|
boot?: (
|
|
48
|
-
store: Store<
|
|
46
|
+
store: Store<LiveStoreSchema>,
|
|
49
47
|
ctx: { migrationsReport: MigrationsReport; parentSpan: otel.Span },
|
|
50
48
|
) => void | Promise<void> | Effect.Effect<void, unknown, OtelTracer.OtelTracer>
|
|
51
|
-
graphQLOptions?: GraphQLOptions<GraphQLContext>
|
|
52
49
|
otelOptions?: Partial<OtelOptions>
|
|
53
50
|
renderLoading: (status: BootStatus) => ReactElement
|
|
54
51
|
renderError?: (error: UnexpectedError | unknown) => ReactElement
|
|
@@ -69,6 +66,13 @@ interface LiveStoreProviderProps<GraphQLContext extends BaseGraphQLContext> {
|
|
|
69
66
|
batchUpdates: (run: () => void) => void
|
|
70
67
|
disableDevtools?: boolean
|
|
71
68
|
signal?: AbortSignal
|
|
69
|
+
/**
|
|
70
|
+
* Currently only used in the web adapter:
|
|
71
|
+
* If true, registers a beforeunload event listener to confirm unsaved changes.
|
|
72
|
+
*
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
confirmUnsavedChanges?: boolean
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
const defaultRenderError = (error: UnexpectedError | unknown) => (
|
|
@@ -89,11 +93,10 @@ const defaultRenderShutdown = (cause: IntentionalShutdownCause | StoreInterrupte
|
|
|
89
93
|
return <>LiveStore Shutdown due to {reason}</>
|
|
90
94
|
}
|
|
91
95
|
|
|
92
|
-
export const LiveStoreProvider =
|
|
96
|
+
export const LiveStoreProvider = ({
|
|
93
97
|
renderLoading,
|
|
94
98
|
renderError = defaultRenderError,
|
|
95
99
|
renderShutdown = defaultRenderShutdown,
|
|
96
|
-
graphQLOptions,
|
|
97
100
|
otelOptions,
|
|
98
101
|
children,
|
|
99
102
|
schema,
|
|
@@ -103,17 +106,18 @@ export const LiveStoreProvider = <GraphQLContext extends BaseGraphQLContext>({
|
|
|
103
106
|
batchUpdates,
|
|
104
107
|
disableDevtools,
|
|
105
108
|
signal,
|
|
106
|
-
|
|
109
|
+
confirmUnsavedChanges = true,
|
|
110
|
+
}: LiveStoreProviderProps & { children?: ReactNode }): React.ReactElement => {
|
|
107
111
|
const storeCtx = useCreateStore({
|
|
108
112
|
storeId,
|
|
109
113
|
schema,
|
|
110
|
-
graphQLOptions,
|
|
111
114
|
otelOptions,
|
|
112
115
|
boot,
|
|
113
116
|
adapter,
|
|
114
117
|
batchUpdates,
|
|
115
118
|
disableDevtools,
|
|
116
119
|
signal,
|
|
120
|
+
confirmUnsavedChanges,
|
|
117
121
|
})
|
|
118
122
|
|
|
119
123
|
if (storeCtx.stage === 'error') {
|
|
@@ -149,17 +153,19 @@ const withSemaphore = (storeId: SchemaKey) => {
|
|
|
149
153
|
return semaphore.withPermits(1)
|
|
150
154
|
}
|
|
151
155
|
|
|
152
|
-
const useCreateStore =
|
|
156
|
+
const useCreateStore = ({
|
|
153
157
|
schema,
|
|
154
158
|
storeId,
|
|
155
|
-
graphQLOptions,
|
|
156
159
|
otelOptions,
|
|
157
160
|
boot,
|
|
158
161
|
adapter,
|
|
159
162
|
batchUpdates,
|
|
160
163
|
disableDevtools,
|
|
161
164
|
signal,
|
|
162
|
-
|
|
165
|
+
context,
|
|
166
|
+
params,
|
|
167
|
+
confirmUnsavedChanges,
|
|
168
|
+
}: CreateStoreOptions<LiveStoreSchema> & {
|
|
163
169
|
signal?: AbortSignal
|
|
164
170
|
otelOptions?: Partial<OtelOptions>
|
|
165
171
|
}) => {
|
|
@@ -180,13 +186,15 @@ const useCreateStore = <GraphQLContext extends BaseGraphQLContext>({
|
|
|
180
186
|
|
|
181
187
|
const inputPropsCacheRef = React.useRef({
|
|
182
188
|
schema,
|
|
183
|
-
graphQLOptions,
|
|
184
189
|
otelOptions,
|
|
185
190
|
boot,
|
|
186
191
|
adapter,
|
|
187
192
|
batchUpdates,
|
|
188
193
|
disableDevtools,
|
|
189
194
|
signal,
|
|
195
|
+
context,
|
|
196
|
+
params,
|
|
197
|
+
confirmUnsavedChanges,
|
|
190
198
|
})
|
|
191
199
|
|
|
192
200
|
const interrupt = (
|
|
@@ -205,23 +213,27 @@ const useCreateStore = <GraphQLContext extends BaseGraphQLContext>({
|
|
|
205
213
|
|
|
206
214
|
if (
|
|
207
215
|
inputPropsCacheRef.current.schema !== schema ||
|
|
208
|
-
inputPropsCacheRef.current.graphQLOptions !== graphQLOptions ||
|
|
209
216
|
inputPropsCacheRef.current.otelOptions !== otelOptions ||
|
|
210
217
|
inputPropsCacheRef.current.boot !== boot ||
|
|
211
218
|
inputPropsCacheRef.current.adapter !== adapter ||
|
|
212
219
|
inputPropsCacheRef.current.batchUpdates !== batchUpdates ||
|
|
213
220
|
inputPropsCacheRef.current.disableDevtools !== disableDevtools ||
|
|
214
|
-
inputPropsCacheRef.current.signal !== signal
|
|
221
|
+
inputPropsCacheRef.current.signal !== signal ||
|
|
222
|
+
inputPropsCacheRef.current.context !== context ||
|
|
223
|
+
inputPropsCacheRef.current.params !== params ||
|
|
224
|
+
inputPropsCacheRef.current.confirmUnsavedChanges !== confirmUnsavedChanges
|
|
215
225
|
) {
|
|
216
226
|
inputPropsCacheRef.current = {
|
|
217
227
|
schema,
|
|
218
|
-
graphQLOptions,
|
|
219
228
|
otelOptions,
|
|
220
229
|
boot,
|
|
221
230
|
adapter,
|
|
222
231
|
batchUpdates,
|
|
223
232
|
disableDevtools,
|
|
224
233
|
signal,
|
|
234
|
+
context,
|
|
235
|
+
params,
|
|
236
|
+
confirmUnsavedChanges,
|
|
225
237
|
}
|
|
226
238
|
if (ctxValueRef.current.componentScope !== undefined && ctxValueRef.current.shutdownDeferred !== undefined) {
|
|
227
239
|
interrupt(
|
|
@@ -279,12 +291,14 @@ const useCreateStore = <GraphQLContext extends BaseGraphQLContext>({
|
|
|
279
291
|
const store = yield* createStore({
|
|
280
292
|
schema,
|
|
281
293
|
storeId,
|
|
282
|
-
graphQLOptions,
|
|
283
294
|
boot,
|
|
284
295
|
adapter,
|
|
285
296
|
batchUpdates,
|
|
286
297
|
disableDevtools,
|
|
287
298
|
shutdownDeferred,
|
|
299
|
+
context,
|
|
300
|
+
params,
|
|
301
|
+
confirmUnsavedChanges,
|
|
288
302
|
onBootStatus: (status) => {
|
|
289
303
|
if (ctxValueRef.current.value.stage === 'running' || ctxValueRef.current.value.stage === 'error') return
|
|
290
304
|
// NOTE sometimes when status come in in rapid succession, only the last value will be rendered by React
|
|
@@ -333,7 +347,19 @@ const useCreateStore = <GraphQLContext extends BaseGraphQLContext>({
|
|
|
333
347
|
ctxValueRef.current.shutdownDeferred = undefined
|
|
334
348
|
}
|
|
335
349
|
}
|
|
336
|
-
}, [
|
|
350
|
+
}, [
|
|
351
|
+
schema,
|
|
352
|
+
otelOptions,
|
|
353
|
+
boot,
|
|
354
|
+
adapter,
|
|
355
|
+
batchUpdates,
|
|
356
|
+
disableDevtools,
|
|
357
|
+
signal,
|
|
358
|
+
storeId,
|
|
359
|
+
context,
|
|
360
|
+
params,
|
|
361
|
+
confirmUnsavedChanges,
|
|
362
|
+
])
|
|
337
363
|
|
|
338
364
|
return ctxValueRef.current.value
|
|
339
365
|
}
|
package/src/useAtom.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DerivedMutationHelperFns, QueryInfo } from '@livestore/common'
|
|
2
2
|
import type { DbSchema, SqliteDsl } from '@livestore/common/schema'
|
|
3
|
-
import type {
|
|
3
|
+
import type { Store } from '@livestore/livestore'
|
|
4
|
+
import type { LiveQueries } from '@livestore/livestore/internal'
|
|
4
5
|
import { shouldNeverHappen } from '@livestore/utils'
|
|
5
6
|
import React from 'react'
|
|
6
7
|
|
|
@@ -10,13 +11,16 @@ import type { Dispatch, SetStateAction } from './useRow.js'
|
|
|
10
11
|
|
|
11
12
|
export const useAtom = <
|
|
12
13
|
// TODO also support colJsonValue
|
|
13
|
-
TQuery extends LiveQueryDef<any, QueryInfo.Row | QueryInfo.Col>,
|
|
14
|
+
TQuery extends LiveQueries.LiveQueryDef<any, QueryInfo.Row | QueryInfo.Col>,
|
|
14
15
|
>(
|
|
15
16
|
queryDef: TQuery,
|
|
16
17
|
options?: {
|
|
17
18
|
store?: Store
|
|
18
19
|
},
|
|
19
|
-
): [
|
|
20
|
+
): [
|
|
21
|
+
value: LiveQueries.GetResult<TQuery>,
|
|
22
|
+
setValue: Dispatch<SetStateAction<Partial<LiveQueries.GetResult<TQuery>>>>,
|
|
23
|
+
] => {
|
|
20
24
|
const queryRef = useQueryRef(queryDef, { store: options?.store })
|
|
21
25
|
const query$ = queryRef.queryRcRef.value
|
|
22
26
|
|
|
@@ -28,7 +32,7 @@ export const useAtom = <
|
|
|
28
32
|
const { store } = useStore()
|
|
29
33
|
|
|
30
34
|
// TODO make API equivalent to useRow
|
|
31
|
-
const setValue = React.useMemo<Dispatch<SetStateAction<Partial<GetResult<TQuery>>>>>(
|
|
35
|
+
const setValue = React.useMemo<Dispatch<SetStateAction<Partial<LiveQueries.GetResult<TQuery>>>>>(
|
|
32
36
|
() => (newValueOrFn: any) => {
|
|
33
37
|
const newValue = typeof newValueOrFn === 'function' ? newValueOrFn(queryRef.valueRef.current) : newValueOrFn
|
|
34
38
|
const table = query$.queryInfo.table as DbSchema.TableDef &
|