@oxy.so/services 14.19.3 → 14.20.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/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/client.js.map +1 -1
- package/lib/commonjs/ui/hooks/accountQueryPersistence.js +8 -1
- package/lib/commonjs/ui/hooks/accountQueryPersistence.js.map +1 -1
- package/lib/commonjs/ui/hooks/persistedQueryCache.js +103 -8
- package/lib/commonjs/ui/hooks/persistedQueryCache.js.map +1 -1
- package/lib/commonjs/ui/hooks/queryClient.js +5 -1
- package/lib/commonjs/ui/hooks/queryClient.js.map +1 -1
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/utils/persistedDataVersion.js +16 -0
- package/lib/commonjs/ui/utils/persistedDataVersion.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/client.js +3 -0
- package/lib/module/ui/client.js.map +1 -1
- package/lib/module/ui/hooks/accountQueryPersistence.js +9 -2
- package/lib/module/ui/hooks/accountQueryPersistence.js.map +1 -1
- package/lib/module/ui/hooks/persistedQueryCache.js +101 -8
- package/lib/module/ui/hooks/persistedQueryCache.js.map +1 -1
- package/lib/module/ui/hooks/queryClient.js +6 -2
- package/lib/module/ui/hooks/queryClient.js.map +1 -1
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/utils/persistedDataVersion.js +12 -0
- package/lib/module/ui/utils/persistedDataVersion.js.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/client.d.ts +2 -0
- package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/accountQueryPersistence.d.ts +17 -0
- package/lib/typescript/commonjs/ui/hooks/accountQueryPersistence.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/persistedQueryCache.d.ts +39 -3
- package/lib/typescript/commonjs/ui/hooks/persistedQueryCache.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queryClient.d.ts +2 -1
- package/lib/typescript/commonjs/ui/hooks/queryClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/icons/Ionicons.d.ts +1 -1
- package/lib/typescript/commonjs/ui/icons/MaterialCommunityIcons.d.ts +1 -1
- package/lib/typescript/commonjs/ui/index.d.ts +1 -0
- package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/persistedDataVersion.d.ts +10 -0
- package/lib/typescript/commonjs/ui/utils/persistedDataVersion.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +1 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/client.d.ts +2 -0
- package/lib/typescript/module/ui/client.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/accountQueryPersistence.d.ts +17 -0
- package/lib/typescript/module/ui/hooks/accountQueryPersistence.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/persistedQueryCache.d.ts +39 -3
- package/lib/typescript/module/ui/hooks/persistedQueryCache.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queryClient.d.ts +2 -1
- package/lib/typescript/module/ui/hooks/queryClient.d.ts.map +1 -1
- package/lib/typescript/module/ui/icons/Ionicons.d.ts +1 -1
- package/lib/typescript/module/ui/icons/MaterialCommunityIcons.d.ts +1 -1
- package/lib/typescript/module/ui/index.d.ts +1 -0
- package/lib/typescript/module/ui/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/persistedDataVersion.d.ts +10 -0
- package/lib/typescript/module/ui/utils/persistedDataVersion.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/ui/client.ts +3 -0
- package/src/ui/hooks/accountQueryPersistence.ts +26 -0
- package/src/ui/hooks/persistedQueryCache.ts +132 -13
- package/src/ui/hooks/queryClient.ts +6 -1
- package/src/ui/index.ts +1 -0
- package/src/ui/utils/persistedDataVersion.ts +9 -0
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
PERSISTED_QUERY_PREFIXES,
|
|
31
31
|
hydrateSnapshot,
|
|
32
32
|
keepPersistedRootsInMemory,
|
|
33
|
+
persistedBuster,
|
|
33
34
|
subscribeSnapshots,
|
|
34
35
|
type PersistFilters,
|
|
35
36
|
} from './persistedQueryCache';
|
|
@@ -147,7 +148,8 @@ export interface AttachPersistenceResult {
|
|
|
147
148
|
/**
|
|
148
149
|
* Restore, then keep writing, the account-agnostic cache.
|
|
149
150
|
*
|
|
150
|
-
* Queries written
|
|
151
|
+
* Queries written under another buster are dropped (the build, or the app's declared
|
|
152
|
+
* `dataVersion`); queued mutations are kept
|
|
151
153
|
* (`persistedQueryCache.ts`). Whatever belongs to the account (`accountQueries`,
|
|
152
154
|
* or a query marked `meta: { persist: 'account' }`) is left to
|
|
153
155
|
* `createAccountQueryPersistence`, even under one of the SDK's prefixes, so
|
|
@@ -171,7 +173,9 @@ export const attachQueryPersistence = (
|
|
|
171
173
|
|
|
172
174
|
const account = accountQueryOwnership(accountQueries);
|
|
173
175
|
keepPersistedRootsInMemory(queryClient, PERSISTED_QUERY_PREFIXES);
|
|
176
|
+
const buster = persistedBuster(accountQueries?.dataVersion);
|
|
174
177
|
const filters: PersistFilters = {
|
|
178
|
+
buster,
|
|
175
179
|
persistsQuery: (query) => isSharedQuery(query) && !account.ownsQuery(query),
|
|
176
180
|
// Every other mutation, whatever its status: paused ones are exactly the
|
|
177
181
|
// ones that must survive a restart to replay when online.
|
|
@@ -185,6 +189,7 @@ export const attachQueryPersistence = (
|
|
|
185
189
|
if (stopped) return;
|
|
186
190
|
if (
|
|
187
191
|
!hydrateSnapshot(queryClient, raw, QUERY_CACHE_MAX_AGE, {
|
|
192
|
+
buster,
|
|
188
193
|
shouldRestoreQuery: (query) => !account.ownsQuery(query),
|
|
189
194
|
restoreMutations: accountQueries?.clearUnregisteredMutations !== true,
|
|
190
195
|
shouldRestoreMutation: (mutation) => !account.ownsMutationKey(mutation.mutationKey),
|
package/src/ui/index.ts
CHANGED
|
@@ -39,6 +39,7 @@ export { RequireOxyAuth } from './components/RequireOxyAuth';
|
|
|
39
39
|
export type { RequireOxyAuthProps, RequireOxyAuthPrompt } from './components/RequireOxyAuth';
|
|
40
40
|
// `OxyProvider`'s `accountQueries`: the app's per-account offline cache.
|
|
41
41
|
export type { AccountQueriesConfig, AccountQueryMeta } from './hooks/accountQueryPersistence';
|
|
42
|
+
export type { PersistedRootBound } from './hooks/persistedQueryCache';
|
|
42
43
|
export { default as FollowButton } from './components/FollowButton';
|
|
43
44
|
export { default as PeableButton } from './components/PeableButton';
|
|
44
45
|
export type { PeableButtonProps } from './components/PeableButton';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This package's version, as part of every declared-version buster (`persistedBuster`).
|
|
3
|
+
*
|
|
4
|
+
* The SDK owns the shape of the shared roots (`accounts`, `users`, ...) and of the blob itself, so
|
|
5
|
+
* an app that declares its own data version still starts from the network after an SDK upgrade.
|
|
6
|
+
* `__tests__/hooks/persistedDataVersion.test.ts` keeps it equal to `package.json`'s `version`, so a
|
|
7
|
+
* release cannot forget it.
|
|
8
|
+
*/
|
|
9
|
+
export const SERVICES_PERSISTED_DATA_VERSION = '14.20.0';
|