tsdf 17.0.0-rc.0 → 17.0.0

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/main.d.ts CHANGED
@@ -95,7 +95,13 @@ type CreateStoreManagerOptions<TUploadRef extends ValidPayload = ValidPayload> =
95
95
  * stores attached to this manager. Return `false` to disable session-scoped
96
96
  * behavior while no account is loaded.
97
97
  */
98
- getSessionKey: () => string | false; /** Normalizes raw exceptions into the shared StoreError shape. */
98
+ getSessionKey: () => string | false;
99
+ /**
100
+ * Returns the stable app build version used to isolate browser-tab sync
101
+ * across deployments. The callback is evaluated once when the manager is
102
+ * created.
103
+ */
104
+ getAppVersion?: () => string; /** Normalizes raw exceptions into the shared StoreError shape. */
99
105
  errorNormalizer: (exception: Error) => StoreError; /** Default minimum interval between low-priority fetches for attached stores. Defaults to 40 minutes. */
100
106
  lowPriorityThrottleMs?: number; /** Default coalescing window for attached stores. Defaults to 16ms. */
101
107
  baseCoalescingWindowMs?: number; /** Extra browser-tab coalescing delay applied only while a tab is in the background. Defaults to 3000ms. */
package/dist/main.js CHANGED
@@ -3455,6 +3455,9 @@ function createBrowserTabsPriority(transportEnabled, getIsEnabled, tabId, getWin
3455
3455
  //#region src/utils/browserTabsSync.ts
3456
3456
  const PROTOCOL_VERSION = 1;
3457
3457
  const CHANNEL_PREFIX = "tsdf";
3458
+ function createBrowserTabsChannelName(storeType, storeKey, appVersion) {
3459
+ return `${CHANNEL_PREFIX}${appVersion === void 0 ? "" : `:app:${encodeURIComponent(appVersion)}`}:${storeType}:${storeKey}`;
3460
+ }
3458
3461
  const rawBrowserTabsMessageSchema = rc_object({
3459
3462
  protocolVersion: rc_number,
3460
3463
  messageId: rc_string,
@@ -3489,10 +3492,10 @@ function getDefaultTransportFactory() {
3489
3492
  };
3490
3493
  }
3491
3494
  /** @internal */
3492
- function createBrowserTabsCoordinator(storeType, storeKey, getSessionKey, onMessage, onSessionChange, transportFactory, debugLoggerInput, tabId = createBrowserTabsTabId()) {
3495
+ function createBrowserTabsCoordinator(storeType, storeKey, getSessionKey, onMessage, onSessionChange, transportFactory, debugLoggerInput, tabId = createBrowserTabsTabId(), appVersion) {
3493
3496
  const resolvedTransportFactory = transportFactory ?? getDefaultTransportFactory();
3494
3497
  const debugLogger = import.meta.env.DEV ? debugLoggerInput : void 0;
3495
- const channelName = `${CHANNEL_PREFIX}:${storeType}:${storeKey}`;
3498
+ const channelName = createBrowserTabsChannelName(storeType, storeKey, appVersion);
3496
3499
  let seq = 0;
3497
3500
  const lastSeenSeqByTab = /* @__PURE__ */ new Map();
3498
3501
  let currentSessionKey;
@@ -3632,15 +3635,15 @@ function createBrowserTabsCoordinator(storeType, storeKey, getSessionKey, onMess
3632
3635
  };
3633
3636
  }
3634
3637
  /** @internal */
3635
- function createBrowserTabsCoordinatorWithPriority(storeType, storeKey, getSessionKey, onMessage, onSessionChange, transportFactory, debugLoggerInput, getWindowIsFocused, onWindowFocusChange, priorityTimings, tabId) {
3638
+ function createBrowserTabsCoordinatorWithPriority(storeType, storeKey, getSessionKey, onMessage, onSessionChange, transportFactory, debugLoggerInput, getWindowIsFocused, onWindowFocusChange, priorityTimings, tabId, appVersion) {
3636
3639
  const debugLogger = import.meta.env.DEV ? debugLoggerInput : void 0;
3637
- const channelName = `${CHANNEL_PREFIX}:${storeType}:${storeKey}`;
3640
+ const channelName = createBrowserTabsChannelName(storeType, storeKey, appVersion);
3638
3641
  const priorityRef = { current: null };
3639
3642
  const coordinator = createBrowserTabsCoordinator(storeType, storeKey, getSessionKey, onMessage, (sessionKey, previousSessionKey) => {
3640
3643
  priorityRef.current?.reset();
3641
3644
  if (sessionKey !== false && coordinator.enabled) priorityRef.current?.publishLocalStatus();
3642
3645
  onSessionChange?.(sessionKey, previousSessionKey);
3643
- }, transportFactory, debugLoggerInput, tabId);
3646
+ }, transportFactory, debugLoggerInput, tabId, appVersion);
3644
3647
  const priority = createBrowserTabsPriority(coordinator.enabled, () => coordinator.isSessionActive(), coordinator.tabId, getWindowIsFocused, onWindowFocusChange, (status) => {
3645
3648
  coordinator.publish(__LEGIT_CAST__(status));
3646
3649
  }, priorityTimings, import.meta.env.DEV ? (details) => {
@@ -3670,7 +3673,7 @@ function createBrowserTabsPresencePriority(options) {
3670
3673
  const priorityRef = { current: null };
3671
3674
  const { coordinator, priority } = createBrowserTabsCoordinatorWithPriority("presence", "manager", options.getSessionKey, (message) => {
3672
3675
  priorityRef.current?.onTabStatusMessage(message.tabId, message);
3673
- }, void 0, options.transportFactory, import.meta.env.DEV ? options.debugLogger : void 0, options.getWindowIsFocused, options.onWindowFocusChange, options.priorityTimings);
3676
+ }, void 0, options.transportFactory, import.meta.env.DEV ? options.debugLogger : void 0, options.getWindowIsFocused, options.onWindowFocusChange, options.priorityTimings, void 0, options.appVersion);
3674
3677
  priorityRef.current = priority;
3675
3678
  return {
3676
3679
  priority,
@@ -3772,6 +3775,7 @@ const defaultGetIsOffline = () => !navigator.onLine;
3772
3775
  const defaultStatusBySession = /* @__PURE__ */ new Map();
3773
3776
  const registry = /* @__PURE__ */ new Map();
3774
3777
  const uploadsConfigByOfflineSession = /* @__PURE__ */ new WeakMap();
3778
+ const appVersionByOfflineSession = /* @__PURE__ */ new WeakMap();
3775
3779
  const DEFAULT_UPLOAD_CONCURRENCY = 3;
3776
3780
  const OFFLINE_UPLOAD_RETENTION_MS = 10080 * 60 * 1e3;
3777
3781
  const OFFLINE_UPLOAD_RETENTION_STABLE_ONLINE_MS = 5e3;
@@ -4056,7 +4060,7 @@ var SessionOfflineCoordinator = class {
4056
4060
  return;
4057
4061
  }
4058
4062
  this.#applyRemoteSnapshot(message);
4059
- }, void 0, void 0, import.meta.env.DEV ? debugLogger : void 0, () => !isWindowAvailable() || !document.hidden, void 0, void 0);
4063
+ }, void 0, void 0, import.meta.env.DEV ? debugLogger : void 0, () => !isWindowAvailable() || !document.hidden, void 0, void 0, void 0, options.appVersion);
4060
4064
  this.#refreshLeadership();
4061
4065
  if (shouldBootstrapFromStorage) this.hydrate();
4062
4066
  if (this.#hasCanonicalConfig) this.#refreshNetworkConfig();
@@ -4948,6 +4952,7 @@ function getOrCreateSessionOfflineCoordinator(sessionKey, options = {}) {
4948
4952
  }
4949
4953
  const created = new SessionOfflineCoordinator({
4950
4954
  sessionKey,
4955
+ ...options.appVersion !== void 0 ? { appVersion: options.appVersion } : void 0,
4951
4956
  adapter: options.adapter,
4952
4957
  onPersistentStorageError: options.onPersistentStorageError,
4953
4958
  ...import.meta.env.DEV ? { debugLogger: options.debugLogger } : void 0,
@@ -4982,6 +4987,9 @@ function getGlobalOfflineResolutions(sessionKey) {
4982
4987
  function getOfflineSessionUploadsConfig(session) {
4983
4988
  return __LEGIT_CAST__(uploadsConfigByOfflineSession.get(eraseOfflineSession(session)));
4984
4989
  }
4990
+ function getOfflineSessionAppVersion(session) {
4991
+ return appVersionByOfflineSession.get(session);
4992
+ }
4985
4993
  function createOfflineSession(args) {
4986
4994
  const getSessionKey = args.getSessionKey ?? (() => false);
4987
4995
  const { config } = args;
@@ -5000,6 +5008,7 @@ function createOfflineSession(args) {
5000
5008
  if (sessionKey === false) return null;
5001
5009
  return getOrCreateSessionOfflineCoordinator(sessionKey, {
5002
5010
  config,
5011
+ ...args.appVersion !== void 0 ? { appVersion: args.appVersion } : void 0,
5003
5012
  ...import.meta.env.DEV ? { debugLogger: args.debugLogger } : void 0,
5004
5013
  uploads: eraseUploadsConfig(uploads),
5005
5014
  bootstrapStatusFromLocalStorage
@@ -5007,7 +5016,7 @@ function createOfflineSession(args) {
5007
5016
  }
5008
5017
  function useSessionCoordinator() {
5009
5018
  const activeSessionKey = getSessionKey();
5010
- return useConfiguredSessionOfflineCoordinator(activeSessionKey === false ? resolveOfflineSessionScope(false, inactiveScope) : activeSessionKey, activeSessionKey === false ? void 0 : config, eraseUploadsConfig(activeSessionKey === false ? void 0 : uploads), activeSessionKey !== false, import.meta.env.DEV ? args.debugLogger : void 0);
5019
+ return useConfiguredSessionOfflineCoordinator(activeSessionKey === false ? resolveOfflineSessionScope(false, inactiveScope) : activeSessionKey, activeSessionKey === false ? void 0 : config, eraseUploadsConfig(activeSessionKey === false ? void 0 : uploads), activeSessionKey !== false, import.meta.env.DEV ? args.debugLogger : void 0, args.appVersion);
5011
5020
  }
5012
5021
  const session = {
5013
5022
  getSessionKey,
@@ -5099,18 +5108,21 @@ function createOfflineSession(args) {
5099
5108
  }
5100
5109
  };
5101
5110
  uploadsConfigByOfflineSession.set(eraseOfflineSession(session), eraseUploadsConfig(uploads));
5111
+ appVersionByOfflineSession.set(eraseOfflineSession(session), args.appVersion);
5102
5112
  return session;
5103
5113
  }
5104
5114
  function useSessionOfflineCoordinator(sessionKey, bootstrapStatusFromLocalStorage = false) {
5105
5115
  return useMemo(() => registry.get(sessionKey) ?? getOrCreateSessionOfflineCoordinator(sessionKey, { bootstrapStatusFromLocalStorage }), [bootstrapStatusFromLocalStorage, sessionKey]);
5106
5116
  }
5107
- function useConfiguredSessionOfflineCoordinator(sessionKey, config, uploads, bootstrapStatusFromLocalStorage = false, debugLogger) {
5117
+ function useConfiguredSessionOfflineCoordinator(sessionKey, config, uploads, bootstrapStatusFromLocalStorage = false, debugLogger, appVersion) {
5108
5118
  return useMemo(() => getOrCreateSessionOfflineCoordinator(sessionKey, {
5109
5119
  config,
5120
+ ...appVersion !== void 0 ? { appVersion } : void 0,
5110
5121
  ...import.meta.env.DEV ? { debugLogger } : void 0,
5111
5122
  uploads,
5112
5123
  bootstrapStatusFromLocalStorage
5113
5124
  }), [
5125
+ appVersion,
5114
5126
  bootstrapStatusFromLocalStorage,
5115
5127
  config,
5116
5128
  debugLogger,
@@ -5357,6 +5369,7 @@ function initializeOfflineStoreController(controller) {
5357
5369
  }
5358
5370
  function createOfflineStoreController(storeName, storeType, getSessionKey, onPersistentStorageError, debugLogger, adapter, storeAdapter, offlineSession, operations) {
5359
5371
  const sessionConfig = offlineSession.getConfig();
5372
+ const appVersion = getOfflineSessionAppVersion(offlineSession);
5360
5373
  const activeDebugLogger = import.meta.env.DEV ? debugLogger : void 0;
5361
5374
  const replayQueue = createAsyncQueue({
5362
5375
  concurrency: 1,
@@ -5483,6 +5496,7 @@ function createOfflineStoreController(storeName, storeType, getSessionKey, onPer
5483
5496
  if (activeSession?.sessionKey === targetSessionKey) return activeSession;
5484
5497
  teardownActiveSession();
5485
5498
  const session = getOrCreateSessionOfflineCoordinator(targetSessionKey, {
5499
+ ...appVersion !== void 0 ? { appVersion } : void 0,
5486
5500
  adapter,
5487
5501
  onPersistentStorageError,
5488
5502
  ...import.meta.env.DEV ? { debugLogger: activeDebugLogger } : void 0,
@@ -7865,13 +7879,15 @@ function createDisabledStoreManagerOfflineApi(getSessionKey) {
7865
7879
  };
7866
7880
  }
7867
7881
  function createStoreManager(options) {
7882
+ const appVersion = options.getAppVersion?.();
7868
7883
  const debugLogger = import.meta.env.DEV ? resolveTSDFLogger(options.debugLogger) : void 0;
7869
7884
  const logger = resolveTSDFLogger(options.logger ?? true);
7870
7885
  let resolvedOfflineSession;
7871
7886
  if (options.offlineSession) {
7872
7887
  const createOfflineSessionOptions = {
7873
7888
  config: options.offlineSession,
7874
- getSessionKey: options.getSessionKey
7889
+ getSessionKey: options.getSessionKey,
7890
+ ...appVersion !== void 0 ? { appVersion } : void 0
7875
7891
  };
7876
7892
  if (debugLogger !== void 0) createOfflineSessionOptions.debugLogger = debugLogger;
7877
7893
  resolvedOfflineSession = createOfflineSession(createOfflineSessionOptions);
@@ -7901,6 +7917,7 @@ function createStoreManager(options) {
7901
7917
  useOfflineUploads: () => resolvedOfflineSession.useOfflineUploads()
7902
7918
  } : createDisabledStoreManagerOfflineApi(options.getSessionKey);
7903
7919
  const registry = {
7920
+ appVersion,
7904
7921
  browserTabsPresence: void 0,
7905
7922
  nextStoreRegistrationId: 0,
7906
7923
  stores: /* @__PURE__ */ new Map()
@@ -7961,10 +7978,14 @@ function registerStoreWithManager(storeManager, store) {
7961
7978
  }
7962
7979
  };
7963
7980
  }
7981
+ function getStoreManagerAppVersion(storeManager) {
7982
+ return getRegistryOrThrow(storeManager).appVersion;
7983
+ }
7964
7984
  function getOrCreateStoreManagerBrowserTabsPresence(storeManager, options) {
7965
7985
  const registry = getRegistryOrThrow(storeManager);
7966
7986
  const presence = registry.browserTabsPresence ??= createBrowserTabsPresencePriority({
7967
7987
  getSessionKey: storeManager.getSessionKey,
7988
+ ...registry.appVersion !== void 0 ? { appVersion: registry.appVersion } : void 0,
7968
7989
  getWindowIsFocused: options.getWindowIsFocused,
7969
7990
  onWindowFocusChange: options.onWindowFocusChange,
7970
7991
  transportFactory: options.transportFactory,
@@ -9206,7 +9227,7 @@ function createCollectionStore(storeOptions) {
9206
9227
  const browserTabsSync = createBrowserTabsCoordinator("collection", id, getSessionKeyForRuntime, handleRemoteMessage, () => {
9207
9228
  lastCollectionSyncVersions.clear();
9208
9229
  clearOfflineOverlays();
9209
- }, testOptions?.browserTabsTransportFactory, import.meta.env.DEV ? storeManager.debugLogger : void 0, browserTabsTabId);
9230
+ }, testOptions?.browserTabsTransportFactory, import.meta.env.DEV ? storeManager.debugLogger : void 0, browserTabsTabId, getStoreManagerAppVersion(storeManager));
9210
9231
  async function executeBatchFetch$1(requests, fetchCtx, batchKey) {
9211
9232
  const results = await executeBatchFetch(requests, fetchCtx, store, fetchFn, batchFetchFn, errorNormalizer, batchKey, offlineController);
9212
9233
  const successfulRequests = requests.filter(({ requestId }) => results.get(requestId) === true);
@@ -10079,7 +10100,7 @@ function createDocumentStore(storeOptions) {
10079
10100
  const browserTabsSync = createBrowserTabsCoordinator("document", id, getSessionKeyForRuntime, handleRemoteMessage, () => {
10080
10101
  lastDocumentSyncVersion = void 0;
10081
10102
  clearOfflineOverlay();
10082
- }, testOptions?.browserTabsTransportFactory, import.meta.env.DEV ? storeManager.debugLogger : void 0, browserTabsTabId);
10103
+ }, testOptions?.browserTabsTransportFactory, import.meta.env.DEV ? storeManager.debugLogger : void 0, browserTabsTabId, getStoreManagerAppVersion(storeManager));
10083
10104
  async function executeFetch(fetchCtx) {
10084
10105
  const currentStatus = store.state.status;
10085
10106
  const wasLoadedBeforeFetch = currentStatus === "success";
@@ -14613,12 +14634,12 @@ function useMultipleItems(items, { selector, loadFromStateOnly, returnIdleStatus
14613
14634
  const fetchPriority = event.priority !== "highPriority" && itemHasMissingRequestedData(event.itemKey, hookFields) ? "highPriority" : event.priority;
14614
14635
  if (itemInvalidationWasTriggered.has(event.itemKey)) {
14615
14636
  if (!fieldsToFetch) return;
14616
- const contributionFields = hasUnresolvedFullInvalidation ? isUnboundedHook ? void 0 : excludeLoadedFields(loadedFields, hookFields) : isUnboundedHook ? Array.from(owedStaleFields) : hookFields.filter((field) => owedStaleFields.has(field));
14617
- if (contributionFields && contributionFields.length === 0) return;
14637
+ const contributionFields = hasUnresolvedFullInvalidation ? isUnboundedHook ? "*" : excludeLoadedFields(loadedFields, hookFields) : isUnboundedHook ? Array.from(owedStaleFields) : hookFields.filter((field) => owedStaleFields.has(field));
14638
+ if (contributionFields.length === 0) return;
14618
14639
  scheduleAutomaticItemFetch(fetchPriority, firstQuery.payload, { fields: contributionFields });
14619
14640
  return;
14620
14641
  }
14621
- if (fieldsToFetch) if (hasUnresolvedFullInvalidation) fieldsToFetch = isUnboundedHook ? void 0 : Array.from(new Set([...fieldsToFetch, ...excludeLoadedFields(loadedFields, hookFields)])).sort();
14642
+ if (fieldsToFetch) if (hasUnresolvedFullInvalidation) fieldsToFetch = isUnboundedHook ? "*" : Array.from(new Set([...fieldsToFetch, ...excludeLoadedFields(loadedFields, hookFields)])).sort();
14622
14643
  else {
14623
14644
  const rideAlongFields = isUnboundedHook ? Array.from(owedStaleFields) : hookFields.filter((field) => owedStaleFields.has(field));
14624
14645
  fieldsToFetch = Array.from(new Set([...fieldsToFetch, ...rideAlongFields])).sort();
@@ -15662,7 +15683,7 @@ function createListQueryStore(storeOptions) {
15662
15683
  lastQuerySyncVersions.clear();
15663
15684
  lastItemSyncVersions.clear();
15664
15685
  clearOfflineOverlays();
15665
- }, testOptions?.browserTabsTransportFactory, import.meta.env.DEV ? storeManager.debugLogger : void 0, browserTabsTabId);
15686
+ }, testOptions?.browserTabsTransportFactory, import.meta.env.DEV ? storeManager.debugLogger : void 0, browserTabsTabId, getStoreManagerAppVersion(storeManager));
15666
15687
  function getQueryTargetKey(queryKey) {
15667
15688
  return `query:${queryKey}`;
15668
15689
  }
package/docs/README.md CHANGED
@@ -45,6 +45,7 @@ import { createDocumentStore, createStoreManager } from 'tsdf';
45
45
 
46
46
  const storeManager = createStoreManager({
47
47
  getSessionKey: () => (auth.userId ? `tenant:${auth.tenantId}` : false),
48
+ getAppVersion: () => BUILD_VERSION,
48
49
  errorNormalizer: (err) => ({
49
50
  code: 500,
50
51
  id: 'fetch-error',
@@ -8,6 +8,7 @@ Browser tabs sync is available when all of these are true:
8
8
 
9
9
  - All tabs use the same `id` for the same store
10
10
  - `storeManager.getSessionKey()` returns the same string in all tabs
11
+ - If configured, the `createStoreManager({ getAppVersion })` callback returns the same build version in all tabs
11
12
  - Tab communication is available (default: `BroadcastChannel`)
12
13
 
13
14
  If `getSessionKey` returns `false`, sync is disabled for that store instance.
@@ -32,9 +33,22 @@ Tabs use a versioned message model so later snapshots do not overwrite fresher r
32
33
 
33
34
  - Same `id` with different `sessionKey` values do not sync.
34
35
  - Different `id` values do not sync.
36
+ - Different values from the configured `getAppVersion` callback do not share any browser-tab sync channels.
35
37
  - When `sessionKey` changes (for example, login/logout), sync state is refreshed for the new session.
36
38
  - If transport is unavailable, sync becomes inactive silently.
37
39
 
40
+ Apps deployed while users may keep older tabs open should always provide `getAppVersion`. Return a stable release or build identifier that changes whenever a new bundle is deployed:
41
+
42
+ ```ts
43
+ const storeManager = createStoreManager({
44
+ getSessionKey: () => currentTenantId ?? false,
45
+ getAppVersion: () => BUILD_VERSION,
46
+ errorNormalizer: normalizeError,
47
+ });
48
+ ```
49
+
50
+ TSDF evaluates the callback once when the manager is created and namespaces every sync channel with that value: manager presence, document, collection, list-query, and offline-session channels. During a mixed-version rollout, old and new tabs therefore use their own network requests and in-memory snapshots. This prevents both cross-version snapshot injection and cross-version `fetch-start` deduplication. `getAppVersion` only scopes browser-tab sync; use `persistentStorage.version` separately for persisted cache migrations.
51
+
38
52
  Enable `createStoreManager({ debugLogger: true, ... })` to inspect transport open/close, publish, receive, skipped-message events, and leader changes in development. Store data sync uses store-specific channels, while tab-presence status uses one shared `presence` channel per manager/session. Presence prioritizes the focused tab; background tabs announce open/focus/blur changes and keep their last known fallback rank during quiet periods. Leader-change entries include the elected `leaderTabId`, whether the local tab is the leader, the local tab rank, and the ranked live-tab snapshot. Pass a logger function as `debugLogger` to route those entries to your own tooling.
39
53
 
40
54
  ## Required options
@@ -46,6 +60,7 @@ const storeManager = createStoreManager({
46
60
  getSessionKey: () => {
47
61
  return isLoggedIn ? `tenant:${tenantId}` : false;
48
62
  },
63
+ getAppVersion: () => BUILD_VERSION,
49
64
  errorNormalizer: normalizeError,
50
65
  backgroundCoalescingDelayMs: 3_000,
51
66
  });
@@ -11,6 +11,7 @@ import { createStoreManager } from 'tsdf';
11
11
 
12
12
  const storeManager = createStoreManager({
13
13
  getSessionKey: () => currentTenantId ?? false,
14
+ getAppVersion: () => BUILD_VERSION,
14
15
  errorNormalizer: (error) => ({
15
16
  code: 500,
16
17
  id: 'unknown-error',
@@ -38,6 +39,7 @@ Options:
38
39
  | Option | Required | Description |
39
40
  | ----------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
40
41
  | `getSessionKey` | Yes | Returns the active tenant/account key. Return `false` while no session is ready. |
42
+ | `getAppVersion` | No | Returns a stable build/release version that namespaces browser-tab sync so different deployments cannot exchange fetch activity or snapshots. |
41
43
  | `errorNormalizer` | Yes | Converts thrown `Error` values into TSDF's shared `StoreError` shape. |
42
44
  | `lowPriorityThrottleMs` | No | Default minimum interval between low-priority fetches for attached stores. Defaults to 40 minutes (`2_400_000ms`). |
43
45
  | `baseCoalescingWindowMs` | No | Default window to group fetch requests for attached stores. Defaults to `16ms`. |
@@ -53,6 +55,8 @@ Options:
53
55
 
54
56
  The session key is used by browser-tab sync, persistent storage, and offline state. Stores with the same `id` but different session keys are isolated.
55
57
 
58
+ For apps that can have tabs from different deployments open at the same time, provide `getAppVersion` and return the same stable build version used by your error tracking or release tooling. TSDF evaluates it once when the manager is created and includes the result in every browser-tab sync channel, including manager presence and offline-session coordination. Tabs on different versions then fetch independently and cannot apply each other's snapshots. This option does not version persistent storage; continue using each store's `persistentStorage.version` when its persisted data shape changes.
59
+
56
60
  Stores inherit the manager's `lowPriorityThrottleMs`, `baseCoalescingWindowMs`, and `dynamicRealtimeThrottleMs` unless they provide their own store-level overrides. `backgroundCoalescingDelayMs` and `blockWindowClose` are manager-only so browser-tab background coordination and window-close mutation protection stay consistent across attached stores. The built-in `dynamicRealtimeThrottleMs` default returns `100ms` while focused and `1000ms` while the window is in the background.
57
61
 
58
62
  Store-level options can explicitly disable inherited defaults when the option supports disabling: use `revalidateOnWindowFocus: false`, `onMutationError: null`, or `persistentStorage.onPersistentStorageError: null`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdf",
3
- "version": "17.0.0-rc.0",
3
+ "version": "17.0.0",
4
4
  "description": "A data fetching solution based on t-state",
5
5
  "license": "PolyForm-Noncommercial-1.0.0",
6
6
  "author": "Lucas Santos",