@livestore/react 0.4.0-dev.20 → 0.4.0-dev.21

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.
Files changed (40) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/LiveStoreContext.d.ts +27 -0
  3. package/dist/LiveStoreContext.d.ts.map +1 -1
  4. package/dist/LiveStoreContext.js +18 -0
  5. package/dist/LiveStoreContext.js.map +1 -1
  6. package/dist/LiveStoreProvider.d.ts +9 -2
  7. package/dist/LiveStoreProvider.d.ts.map +1 -1
  8. package/dist/LiveStoreProvider.js +2 -1
  9. package/dist/LiveStoreProvider.js.map +1 -1
  10. package/dist/experimental/multi-store/StoreRegistry.d.ts +60 -16
  11. package/dist/experimental/multi-store/StoreRegistry.d.ts.map +1 -1
  12. package/dist/experimental/multi-store/StoreRegistry.js +125 -216
  13. package/dist/experimental/multi-store/StoreRegistry.js.map +1 -1
  14. package/dist/experimental/multi-store/StoreRegistry.test.js +224 -307
  15. package/dist/experimental/multi-store/StoreRegistry.test.js.map +1 -1
  16. package/dist/experimental/multi-store/types.d.ts +4 -23
  17. package/dist/experimental/multi-store/types.d.ts.map +1 -1
  18. package/dist/experimental/multi-store/useStore.d.ts +1 -1
  19. package/dist/experimental/multi-store/useStore.d.ts.map +1 -1
  20. package/dist/experimental/multi-store/useStore.js +5 -10
  21. package/dist/experimental/multi-store/useStore.js.map +1 -1
  22. package/dist/experimental/multi-store/useStore.test.js +95 -41
  23. package/dist/experimental/multi-store/useStore.test.js.map +1 -1
  24. package/dist/useClientDocument.d.ts +33 -0
  25. package/dist/useClientDocument.d.ts.map +1 -1
  26. package/dist/useClientDocument.js.map +1 -1
  27. package/dist/useStore.d.ts +51 -0
  28. package/dist/useStore.d.ts.map +1 -1
  29. package/dist/useStore.js +51 -0
  30. package/dist/useStore.js.map +1 -1
  31. package/package.json +6 -6
  32. package/src/LiveStoreContext.ts +27 -0
  33. package/src/LiveStoreProvider.tsx +9 -0
  34. package/src/experimental/multi-store/StoreRegistry.test.ts +236 -349
  35. package/src/experimental/multi-store/StoreRegistry.ts +171 -265
  36. package/src/experimental/multi-store/types.ts +31 -49
  37. package/src/experimental/multi-store/useStore.test.tsx +120 -48
  38. package/src/experimental/multi-store/useStore.ts +5 -13
  39. package/src/useClientDocument.ts +35 -0
  40. package/src/useStore.ts +51 -0
@@ -1,4 +1,6 @@
1
- import { createStorePromise } from '@livestore/livestore';
1
+ import { OtelLiveDummy, UnknownError } from '@livestore/common';
2
+ import { createStore } from '@livestore/livestore';
3
+ import { Cause, Effect, Equal, Exit, Fiber, Hash, Layer, ManagedRuntime, RcMap, Runtime, } from '@livestore/utils/effect';
2
4
  /**
3
5
  * Default time to keep unused stores in cache.
4
6
  *
@@ -9,248 +11,159 @@ import { createStorePromise } from '@livestore/livestore';
9
11
  */
10
12
  export const DEFAULT_UNUSED_CACHE_TIME = typeof window === 'undefined' ? Number.POSITIVE_INFINITY : 60_000;
11
13
  /**
12
- * @typeParam TSchema - The schema for this entry's store.
13
- * @internal
14
+ * RcMap cache key that uses storeId for equality/hashing but carries full options.
15
+ * This allows RcMap to deduplicate by storeId while the lookup function has access to all options.
16
+ *
17
+ * @remarks
18
+ * Only `storeId` is used for equality and hashing. This means if `getOrLoadPromise` is called
19
+ * with different options (e.g., different `adapter`) but the same `storeId`, the cached store
20
+ * from the first call will be returned. This is intentional - a store's identity is determined
21
+ * solely by its `storeId`, and callers should not expect to get different stores by varying
22
+ * other options while keeping the same `storeId`.
14
23
  */
15
- class StoreEntry {
16
- #storeId;
17
- #cache;
18
- #state = { status: 'idle' };
19
- #unusedCacheTime;
20
- #disposalTimeout;
21
- /**
22
- * Set of subscriber callbacks to notify on state changes.
23
- */
24
- #subscribers = new Set();
25
- constructor(storeId, cache) {
26
- this.#storeId = storeId;
27
- this.#cache = cache;
24
+ class StoreCacheKey {
25
+ options;
26
+ constructor(options) {
27
+ this.options = options;
28
28
  }
29
- #scheduleDisposal = () => {
30
- this.#cancelDisposal();
31
- const effectiveTime = this.#unusedCacheTime === undefined ? DEFAULT_UNUSED_CACHE_TIME : this.#unusedCacheTime;
32
- if (effectiveTime === Number.POSITIVE_INFINITY)
33
- return; // Infinity disables disposal
34
- this.#disposalTimeout = setTimeout(() => {
35
- this.#disposalTimeout = null;
36
- // Re-check to avoid racing with a new subscription
37
- if (this.#subscribers.size > 0)
38
- return;
39
- // Abort any in-progress loading to release resources early
40
- this.#abortLoading();
41
- // Transition to shutting_down state BEFORE starting async shutdown.
42
- // This prevents new subscribers from receiving a store that's about to be disposed.
43
- const shutdownPromise = this.#shutdown().finally(() => {
44
- // Reset to idle so fresh loads can proceed, then remove from cache if still inactive
45
- this.#setIdle();
46
- if (this.#subscribers.size === 0)
47
- this.#cache.delete(this.#storeId);
48
- });
49
- this.#setShuttingDown(shutdownPromise);
50
- }, effectiveTime);
51
- };
52
- #cancelDisposal = () => {
53
- if (!this.#disposalTimeout)
54
- return;
55
- clearTimeout(this.#disposalTimeout);
56
- this.#disposalTimeout = null;
57
- };
58
29
  /**
59
- * Transitions to the loading state.
30
+ * Equality is based solely on `storeId`. Other options in `CachedStoreOptions` are ignored
31
+ * for cache key comparison. The first options used for a given `storeId` determine the
32
+ * store's configuration.
60
33
  */
61
- #setLoading(promise, abortController) {
62
- if (this.#state.status === 'success' || this.#state.status === 'loading')
63
- return;
64
- this.#state = { status: 'loading', promise, abortController };
65
- this.#notify();
34
+ [Equal.symbol](that) {
35
+ return that instanceof StoreCacheKey && this.options.storeId === that.options.storeId;
66
36
  }
37
+ [Hash.symbol]() {
38
+ return Hash.string(this.options.storeId);
39
+ }
40
+ }
41
+ /**
42
+ * Store Registry coordinating store loading, caching, and retention
43
+ *
44
+ * @public
45
+ */
46
+ export class StoreRegistry {
67
47
  /**
68
- * Transitions to the success state.
69
- */
70
- #setStore = (store) => {
71
- this.#state = { status: 'success', store };
72
- this.#notify();
73
- };
74
- /**
75
- * Transitions to the error state.
48
+ * Reference-counted cache mapping storeId to Store instances.
49
+ * Stores are created on first access and disposed after `unusedCacheTime` when all references are released.
76
50
  */
77
- #setError = (error) => {
78
- this.#state = { status: 'error', error };
79
- this.#notify();
80
- };
51
+ #rcMap;
81
52
  /**
82
- * Transitions to the shutting_down state.
53
+ * Effect runtime providing Scope and OtelTracer for all registry operations.
54
+ * When the runtime's scope closes, all managed stores are automatically shut down.
83
55
  */
84
- #setShuttingDown = (shutdownPromise) => {
85
- this.#state = { status: 'shutting_down', shutdownPromise };
86
- this.#notify();
87
- };
56
+ #runtime;
88
57
  /**
89
- * Transitions to the idle state.
58
+ * In-flight loading promises keyed by storeId.
59
+ * Ensures concurrent `getOrLoadPromise` calls receive the same Promise reference.
90
60
  */
91
- #setIdle = () => {
92
- this.#state = { status: 'idle' };
93
- // No notify needed - getOrLoad will handle the fresh load
94
- };
61
+ #loadingPromises = new Map();
95
62
  /**
96
- * Notifies all subscribers of state changes.
63
+ * Creates a new StoreRegistry instance.
97
64
  *
98
- * @remarks
99
- * This should be called after any meaningful state change.
100
- */
101
- #notify = () => {
102
- for (const sub of this.#subscribers) {
103
- try {
104
- sub();
105
- }
106
- catch {
107
- // Swallow to protect other listeners
108
- }
109
- }
110
- };
111
- /**
112
- * Subscribes to this entry's updates.
65
+ * @param params.defaultOptions - Default options applied to all stores managed by this registry when they are loaded.
113
66
  *
114
- * @param listener - Callback invoked when the entry changes
115
- * @returns Unsubscribe function
67
+ * @example
68
+ * ```ts
69
+ * const registry = new StoreRegistry({
70
+ * defaultOptions: {
71
+ * batchUpdates,
72
+ * unusedCacheTime: 30_000,
73
+ * }
74
+ * })
75
+ * ```
116
76
  */
117
- subscribe = (listener) => {
118
- this.#cancelDisposal();
119
- this.#subscribers.add(listener);
120
- return () => {
121
- this.#subscribers.delete(listener);
122
- // If no more subscribers remain, schedule disposal
123
- if (this.#subscribers.size === 0)
124
- this.#scheduleDisposal();
125
- };
126
- };
77
+ constructor(params = {}) {
78
+ this.#runtime =
79
+ params.defaultOptions?.runtime ??
80
+ ManagedRuntime.make(Layer.mergeAll(Layer.scope, OtelLiveDummy)).runtimeEffect.pipe(Effect.runSync);
81
+ this.#rcMap = RcMap.make({
82
+ lookup: (key) => Effect.gen(this, function* () {
83
+ const { options } = key;
84
+ return yield* createStore(options).pipe(Effect.catchAllDefect((cause) => UnknownError.make({ cause })));
85
+ }).pipe(Effect.withSpan(`StoreRegistry.lookup:${key.options.storeId}`)),
86
+ // TODO: Make idleTimeToLive vary for each store when Effect supports per-resource TTL
87
+ // See https://github.com/livestorejs/livestore/issues/917
88
+ idleTimeToLive: params.defaultOptions?.unusedCacheTime ?? DEFAULT_UNUSED_CACHE_TIME,
89
+ }).pipe(Runtime.runSync(this.#runtime));
90
+ }
127
91
  /**
128
- * Gets the loaded store or initiates loading if not already in progress.
92
+ * Gets a cached store or loads a new one, with the store lifetime scoped to the caller.
129
93
  *
130
- * @param options - Store creation options
131
- * @returns The loaded store if available, or a Promise that resolves to the loaded store
94
+ * @typeParam TSchema - The schema type for the store
95
+ * @returns An Effect that yields the store, scoped to the provided Scope
132
96
  *
133
97
  * @remarks
134
- * This method handles the complete lifecycle of loading a store:
135
- * - Returns the store directly if already loaded (synchronous)
136
- * - Returns a Promise if loading is in progress or needs to be initiated
137
- * - Transitions through loading success/error states
138
- * - Schedules disposal when loading completes without active subscribers
139
- */
140
- getOrLoad = (options) => {
141
- if (options.unusedCacheTime !== undefined)
142
- this.#unusedCacheTime = Math.max(this.#unusedCacheTime ?? 0, options.unusedCacheTime);
143
- if (this.#state.status === 'success')
144
- return this.#state.store;
145
- if (this.#state.status === 'loading')
146
- return this.#state.promise;
147
- if (this.#state.status === 'error')
148
- throw this.#state.error;
149
- // Wait for shutdown to complete, then recursively call to load a fresh store
150
- if (this.#state.status === 'shutting_down') {
151
- return this.#state.shutdownPromise.then(() => this.getOrLoad(options));
152
- }
153
- const abortController = new AbortController();
154
- const promise = createStorePromise({ ...options, signal: abortController.signal })
155
- .then((store) => {
156
- this.#setStore(store);
157
- return store;
158
- })
159
- .catch((error) => {
160
- this.#setError(error);
161
- throw error;
162
- })
163
- .finally(() => {
164
- // The store entry may have become unused (no subscribers) while loading the store
165
- if (this.#subscribers.size === 0)
166
- this.#scheduleDisposal();
167
- });
168
- this.#setLoading(promise, abortController);
169
- return promise;
170
- };
171
- /**
172
- * Aborts an in-progress store load.
173
- *
174
- * This signals the createStorePromise to cancel, releasing resources like
175
- * worker threads, SQLite connections, and network requests.
98
+ * - Stores are kept in cache and reused while any scope holds them
99
+ * - When the scope closes, the reference is released; the store is disposed after `unusedCacheTime`
100
+ * if no other scopes retain it
101
+ * - Concurrent calls with the same storeId share the same store instance
176
102
  */
177
- #abortLoading = () => {
178
- if (this.#state.status !== 'loading')
179
- return;
180
- this.#state.abortController.abort();
181
- };
182
- #shutdown = async () => {
183
- if (this.#state.status !== 'success')
184
- return;
185
- await this.#state.store.shutdownPromise().catch((reason) => {
186
- console.warn(`Store ${this.#storeId} failed to shutdown cleanly during disposal:`, reason);
187
- });
188
- };
189
- }
190
- /**
191
- * In-memory map of {@link StoreEntry} instances keyed by {@link StoreId}.
192
- *
193
- * @privateRemarks
194
- * The cache is intentionally small; eviction and disposal timers are coordinated by the client.
195
- *
196
- * @internal
197
- */
198
- class StoreCache {
199
- #entries = new Map();
200
- get = (storeId) => {
201
- return this.#entries.get(storeId);
202
- };
203
- ensure = (storeId) => {
204
- let entry = this.#entries.get(storeId);
205
- if (!entry) {
206
- entry = new StoreEntry(storeId, this);
207
- this.#entries.set(storeId, entry);
208
- }
209
- return entry;
210
- };
211
- /**
212
- * Removes an entry from the cache.
213
- *
214
- * @param storeId - The ID of the store to remove
215
- */
216
- delete = (storeId) => {
217
- this.#entries.delete(storeId);
218
- };
219
- }
220
- /**
221
- * Store Registry coordinating store loading, caching, and subscription
222
- *
223
- * @public
224
- */
225
- export class StoreRegistry {
226
- #cache = new StoreCache();
227
- #defaultOptions;
228
- constructor({ defaultOptions = {} } = {}) {
229
- this.#defaultOptions = defaultOptions;
230
- }
231
- #applyDefaultOptions = (options) => ({
232
- ...this.#defaultOptions,
233
- ...options,
234
- });
103
+ getOrLoad = (options) => Effect.gen(this, function* () {
104
+ const key = new StoreCacheKey(options);
105
+ const store = yield* RcMap.get(this.#rcMap, key);
106
+ return store;
107
+ }).pipe(Effect.withSpan(`StoreRegistry.getOrLoad:${options.storeId}`));
235
108
  /**
236
- * Get or load a store, returning it directly if loaded or a promise if loading.
109
+ * Get or load a store, returning it directly if already loaded or a promise if loading.
237
110
  *
238
- * @typeParam TSchema - The schema of the store to load
111
+ * @typeParam TSchema - The schema type for the store
239
112
  * @returns The loaded store if available, or a Promise that resolves to the loaded store
240
113
  * @throws unknown loading error
241
114
  *
242
115
  * @remarks
243
116
  * - Returns the store instance directly (synchronous) when already loaded
244
117
  * - Returns a stable Promise reference when loading is in progress or needs to be initiated
118
+ * - Throws with the same error instance on subsequent calls after failure
245
119
  * - Applies default options from registry config, with call-site options taking precedence
120
+ * - Concurrent calls with the same storeId share the same store instance
246
121
  */
247
- getOrLoad = (options) => {
248
- const optionsWithDefaults = this.#applyDefaultOptions(options);
249
- const storeEntry = this.#cache.ensure(optionsWithDefaults.storeId);
250
- return storeEntry.getOrLoad(optionsWithDefaults);
122
+ getOrLoadPromise = (options) => {
123
+ const exit = this.getOrLoad(options).pipe(Effect.scoped, Runtime.runSyncExit(this.#runtime));
124
+ if (Exit.isSuccess(exit))
125
+ return exit.value;
126
+ // Check if the failure is due to async work
127
+ const defect = Cause.dieOption(exit.cause);
128
+ if (defect._tag === 'Some' && Runtime.isAsyncFiberException(defect.value)) {
129
+ const { storeId } = options;
130
+ // Return cached promise if one exists (ensures concurrent calls get the same Promise reference)
131
+ const cached = this.#loadingPromises.get(storeId);
132
+ if (cached)
133
+ return cached;
134
+ // Create and cache the promise
135
+ const fiber = defect.value.fiber;
136
+ const promise = Fiber.join(fiber)
137
+ .pipe(Runtime.runPromise(this.#runtime))
138
+ .finally(() => this.#loadingPromises.delete(storeId));
139
+ this.#loadingPromises.set(storeId, promise);
140
+ return promise;
141
+ }
142
+ // Handle synchronous failure
143
+ throw Cause.squash(exit.cause);
251
144
  };
252
145
  /**
253
- * Warms the cache for a store without mounting a subscriber.
146
+ * Retains the store in cache until the returned release function is called.
147
+ *
148
+ * @returns A release function that, when called, removes this retention hold
149
+ *
150
+ * @remarks
151
+ * - Multiple retains on the same store are independent; each must be released separately
152
+ * - If the store isn't cached yet, it will be loaded and then retained
153
+ */
154
+ retain = (options) => {
155
+ const release = Effect.gen(this, function* () {
156
+ const key = new StoreCacheKey(options);
157
+ yield* RcMap.get(this.#rcMap, key);
158
+ // Effect.never suspends indefinitely, keeping the RcMap reference alive.
159
+ // When `release()` is called, the fiber is interrupted, closing the scope
160
+ // and releasing the RcMap entry (which may trigger disposal after idleTimeToLive).
161
+ yield* Effect.never;
162
+ }).pipe(Effect.scoped, Runtime.runCallback(this.#runtime));
163
+ return () => release();
164
+ };
165
+ /**
166
+ * Warms the cache for a store without adding a retention.
254
167
  *
255
168
  * @typeParam TSchema - The schema of the store to preload
256
169
  * @returns A promise that resolves when the loading is complete (success or failure)
@@ -261,15 +174,11 @@ export class StoreRegistry {
261
174
  */
262
175
  preload = async (options) => {
263
176
  try {
264
- await this.getOrLoad(options);
177
+ await this.getOrLoadPromise(options);
265
178
  }
266
179
  catch {
267
180
  // Do nothing; preload is best-effort
268
181
  }
269
182
  };
270
- subscribe = (storeId, listener) => {
271
- const entry = this.#cache.ensure(storeId);
272
- return entry.subscribe(listener);
273
- };
274
183
  }
275
184
  //# sourceMappingURL=StoreRegistry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StoreRegistry.js","sourceRoot":"","sources":["../../../src/experimental/multi-store/StoreRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAgC,MAAM,sBAAsB,CAAA;AAUvF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,C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