@tanstack/query-core 4.21.0 → 4.22.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/build/lib/hydration.d.ts +2 -0
- package/build/lib/hydration.esm.js +1 -3
- package/build/lib/hydration.esm.js.map +1 -1
- package/build/lib/hydration.js +2 -2
- package/build/lib/hydration.js.map +1 -1
- package/build/lib/hydration.mjs +1 -3
- package/build/lib/hydration.mjs.map +1 -1
- package/build/lib/index.d.ts +1 -1
- package/build/lib/index.esm.js +1 -1
- package/build/lib/index.js +2 -0
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +1 -1
- package/build/umd/index.development.js +2 -2
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/hydration.ts +2 -2
- package/src/index.ts +6 -1
package/build/lib/hydration.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export interface DehydratedState {
|
|
|
29
29
|
}
|
|
30
30
|
export declare type ShouldDehydrateQueryFunction = (query: Query) => boolean;
|
|
31
31
|
export declare type ShouldDehydrateMutationFunction = (mutation: Mutation) => boolean;
|
|
32
|
+
export declare function defaultShouldDehydrateMutation(mutation: Mutation): boolean;
|
|
33
|
+
export declare function defaultShouldDehydrateQuery(query: Query): boolean;
|
|
32
34
|
export declare function dehydrate(client: QueryClient, options?: DehydrateOptions): DehydratedState;
|
|
33
35
|
export declare function hydrate(client: QueryClient, dehydratedState: unknown, options?: HydrateOptions): void;
|
|
34
36
|
export {};
|
|
@@ -22,11 +22,9 @@ function dehydrateQuery(query) {
|
|
|
22
22
|
function defaultShouldDehydrateMutation(mutation) {
|
|
23
23
|
return mutation.state.isPaused;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
function defaultShouldDehydrateQuery(query) {
|
|
27
26
|
return query.state.status === 'success';
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
function dehydrate(client, options = {}) {
|
|
31
29
|
const mutations = [];
|
|
32
30
|
const queries = [];
|
|
@@ -93,5 +91,5 @@ function hydrate(client, dehydratedState, options) {
|
|
|
93
91
|
});
|
|
94
92
|
}
|
|
95
93
|
|
|
96
|
-
export { dehydrate, hydrate };
|
|
94
|
+
export { defaultShouldDehydrateMutation, defaultShouldDehydrateQuery, dehydrate, hydrate };
|
|
97
95
|
//# sourceMappingURL=hydration.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydration.esm.js","sources":["../../src/hydration.ts"],"sourcesContent":["import type { QueryClient } from './queryClient'\nimport type { Query, QueryState } from './query'\nimport type {\n MutationKey,\n MutationOptions,\n QueryKey,\n QueryOptions,\n} from './types'\nimport type { Mutation, MutationState } from './mutation'\n\n// TYPES\n\nexport interface DehydrateOptions {\n dehydrateMutations?: boolean\n dehydrateQueries?: boolean\n shouldDehydrateMutation?: ShouldDehydrateMutationFunction\n shouldDehydrateQuery?: ShouldDehydrateQueryFunction\n}\n\nexport interface HydrateOptions {\n defaultOptions?: {\n queries?: QueryOptions\n mutations?: MutationOptions\n }\n}\n\ninterface DehydratedMutation {\n mutationKey?: MutationKey\n state: MutationState\n}\n\ninterface DehydratedQuery {\n queryHash: string\n queryKey: QueryKey\n state: QueryState\n}\n\nexport interface DehydratedState {\n mutations: DehydratedMutation[]\n queries: DehydratedQuery[]\n}\n\nexport type ShouldDehydrateQueryFunction = (query: Query) => boolean\n\nexport type ShouldDehydrateMutationFunction = (mutation: Mutation) => boolean\n\n// FUNCTIONS\n\nfunction dehydrateMutation(mutation: Mutation): DehydratedMutation {\n return {\n mutationKey: mutation.options.mutationKey,\n state: mutation.state,\n }\n}\n\n// Most config is not dehydrated but instead meant to configure again when\n// consuming the de/rehydrated data, typically with useQuery on the client.\n// Sometimes it might make sense to prefetch data on the server and include\n// in the html-payload, but not consume it on the initial render.\nfunction dehydrateQuery(query: Query): DehydratedQuery {\n return {\n state: query.state,\n queryKey: query.queryKey,\n queryHash: query.queryHash,\n }\n}\n\
|
|
1
|
+
{"version":3,"file":"hydration.esm.js","sources":["../../src/hydration.ts"],"sourcesContent":["import type { QueryClient } from './queryClient'\nimport type { Query, QueryState } from './query'\nimport type {\n MutationKey,\n MutationOptions,\n QueryKey,\n QueryOptions,\n} from './types'\nimport type { Mutation, MutationState } from './mutation'\n\n// TYPES\n\nexport interface DehydrateOptions {\n dehydrateMutations?: boolean\n dehydrateQueries?: boolean\n shouldDehydrateMutation?: ShouldDehydrateMutationFunction\n shouldDehydrateQuery?: ShouldDehydrateQueryFunction\n}\n\nexport interface HydrateOptions {\n defaultOptions?: {\n queries?: QueryOptions\n mutations?: MutationOptions\n }\n}\n\ninterface DehydratedMutation {\n mutationKey?: MutationKey\n state: MutationState\n}\n\ninterface DehydratedQuery {\n queryHash: string\n queryKey: QueryKey\n state: QueryState\n}\n\nexport interface DehydratedState {\n mutations: DehydratedMutation[]\n queries: DehydratedQuery[]\n}\n\nexport type ShouldDehydrateQueryFunction = (query: Query) => boolean\n\nexport type ShouldDehydrateMutationFunction = (mutation: Mutation) => boolean\n\n// FUNCTIONS\n\nfunction dehydrateMutation(mutation: Mutation): DehydratedMutation {\n return {\n mutationKey: mutation.options.mutationKey,\n state: mutation.state,\n }\n}\n\n// Most config is not dehydrated but instead meant to configure again when\n// consuming the de/rehydrated data, typically with useQuery on the client.\n// Sometimes it might make sense to prefetch data on the server and include\n// in the html-payload, but not consume it on the initial render.\nfunction dehydrateQuery(query: Query): DehydratedQuery {\n return {\n state: query.state,\n queryKey: query.queryKey,\n queryHash: query.queryHash,\n }\n}\n\nexport function defaultShouldDehydrateMutation(mutation: Mutation) {\n return mutation.state.isPaused\n}\n\nexport function defaultShouldDehydrateQuery(query: Query) {\n return query.state.status === 'success'\n}\n\nexport function dehydrate(\n client: QueryClient,\n options: DehydrateOptions = {},\n): DehydratedState {\n const mutations: DehydratedMutation[] = []\n const queries: DehydratedQuery[] = []\n\n if (options.dehydrateMutations !== false) {\n const shouldDehydrateMutation =\n options.shouldDehydrateMutation || defaultShouldDehydrateMutation\n\n client\n .getMutationCache()\n .getAll()\n .forEach((mutation) => {\n if (shouldDehydrateMutation(mutation)) {\n mutations.push(dehydrateMutation(mutation))\n }\n })\n }\n\n if (options.dehydrateQueries !== false) {\n const shouldDehydrateQuery =\n options.shouldDehydrateQuery || defaultShouldDehydrateQuery\n\n client\n .getQueryCache()\n .getAll()\n .forEach((query) => {\n if (shouldDehydrateQuery(query)) {\n queries.push(dehydrateQuery(query))\n }\n })\n }\n\n return { mutations, queries }\n}\n\nexport function hydrate(\n client: QueryClient,\n dehydratedState: unknown,\n options?: HydrateOptions,\n): void {\n if (typeof dehydratedState !== 'object' || dehydratedState === null) {\n return\n }\n\n const mutationCache = client.getMutationCache()\n const queryCache = client.getQueryCache()\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const mutations = (dehydratedState as DehydratedState).mutations || []\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = (dehydratedState as DehydratedState).queries || []\n\n mutations.forEach((dehydratedMutation) => {\n mutationCache.build(\n client,\n {\n ...options?.defaultOptions?.mutations,\n mutationKey: dehydratedMutation.mutationKey,\n },\n dehydratedMutation.state,\n )\n })\n\n queries.forEach((dehydratedQuery) => {\n const query = queryCache.get(dehydratedQuery.queryHash)\n\n // Do not hydrate if an existing query exists with newer data\n if (query) {\n if (query.state.dataUpdatedAt < dehydratedQuery.state.dataUpdatedAt) {\n query.setState(dehydratedQuery.state)\n }\n return\n }\n\n // Restore query\n queryCache.build(\n client,\n {\n ...options?.defaultOptions?.queries,\n queryKey: dehydratedQuery.queryKey,\n queryHash: dehydratedQuery.queryHash,\n },\n dehydratedQuery.state,\n )\n })\n}\n"],"names":["dehydrateMutation","mutation","mutationKey","options","state","dehydrateQuery","query","queryKey","queryHash","defaultShouldDehydrateMutation","isPaused","defaultShouldDehydrateQuery","status","dehydrate","client","mutations","queries","dehydrateMutations","shouldDehydrateMutation","getMutationCache","getAll","forEach","push","dehydrateQueries","shouldDehydrateQuery","getQueryCache","hydrate","dehydratedState","mutationCache","queryCache","dehydratedMutation","build","defaultOptions","dehydratedQuery","get","dataUpdatedAt","setState"],"mappings":"AAUA;AAoCA;AAEA,SAASA,iBAAT,CAA2BC,QAA3B,EAAmE;EACjE,OAAO;AACLC,IAAAA,WAAW,EAAED,QAAQ,CAACE,OAAT,CAAiBD,WADzB;IAELE,KAAK,EAAEH,QAAQ,CAACG,KAAAA;GAFlB,CAAA;AAID;AAGD;AACA;AACA;;;AACA,SAASC,cAAT,CAAwBC,KAAxB,EAAuD;EACrD,OAAO;IACLF,KAAK,EAAEE,KAAK,CAACF,KADR;IAELG,QAAQ,EAAED,KAAK,CAACC,QAFX;IAGLC,SAAS,EAAEF,KAAK,CAACE,SAAAA;GAHnB,CAAA;AAKD,CAAA;;AAEM,SAASC,8BAAT,CAAwCR,QAAxC,EAA4D;AACjE,EAAA,OAAOA,QAAQ,CAACG,KAAT,CAAeM,QAAtB,CAAA;AACD,CAAA;AAEM,SAASC,2BAAT,CAAqCL,KAArC,EAAmD;AACxD,EAAA,OAAOA,KAAK,CAACF,KAAN,CAAYQ,MAAZ,KAAuB,SAA9B,CAAA;AACD,CAAA;AAEM,SAASC,SAAT,CACLC,MADK,EAELX,OAAyB,GAAG,EAFvB,EAGY;EACjB,MAAMY,SAA+B,GAAG,EAAxC,CAAA;EACA,MAAMC,OAA0B,GAAG,EAAnC,CAAA;;AAEA,EAAA,IAAIb,OAAO,CAACc,kBAAR,KAA+B,KAAnC,EAA0C;AACxC,IAAA,MAAMC,uBAAuB,GAC3Bf,OAAO,CAACe,uBAAR,IAAmCT,8BADrC,CAAA;IAGAK,MAAM,CACHK,gBADH,EAEGC,CAAAA,MAFH,GAGGC,OAHH,CAGYpB,QAAD,IAAc;AACrB,MAAA,IAAIiB,uBAAuB,CAACjB,QAAD,CAA3B,EAAuC;AACrCc,QAAAA,SAAS,CAACO,IAAV,CAAetB,iBAAiB,CAACC,QAA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CAAyBjB,SAA5B,CADF;MAEEb,WAAW,EAAE4B,kBAAkB,CAAC5B,WAAAA;KAJpC,EAME4B,kBAAkB,CAAC1B,KANrB,CAAA,CAAA;GADF,CAAA,CAAA;AAWAY,EAAAA,OAAO,CAACK,OAAR,CAAiBY,eAAD,IAAqB;AAAA,IAAA,IAAA,sBAAA,CAAA;;IACnC,MAAM3B,KAAK,GAAGuB,UAAU,CAACK,GAAX,CAAeD,eAAe,CAACzB,SAA/B,CAAd,CADmC;;AAInC,IAAA,IAAIF,KAAJ,EAAW;MACT,IAAIA,KAAK,CAACF,KAAN,CAAY+B,aAAZ,GAA4BF,eAAe,CAAC7B,KAAhB,CAAsB+B,aAAtD,EAAqE;AACnE7B,QAAAA,KAAK,CAAC8B,QAAN,CAAeH,eAAe,CAAC7B,KAA/B,CAAA,CAAA;AACD,OAAA;;AACD,MAAA,OAAA;AACD,KATkC;;;AAYnCyB,IAAAA,UAAU,CAACE,KAAX,CACEjB,MADF,EAEE,EACE,IAAGX,OAAH,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,CAAA,sBAAA,GAAGA,OAAO,CAAE6B,cAAZ,KAAG,IAAA,GAAA,KAAA,CAAA,GAAA,sBAAA,CAAyBhB,OAA5B,CADF;MAEET,QAAQ,EAAE0B,eAAe,CAAC1B,QAF5B;MAGEC,SAAS,EAAEyB,eAAe,CAACzB,SAAAA;KAL/B,EAOEyB,eAAe,CAAC7B,KAPlB,CAAA,CAAA;GAZF,CAAA,CAAA;AAsBD;;;;"}
|
package/build/lib/hydration.js
CHANGED
|
@@ -26,11 +26,9 @@ function dehydrateQuery(query) {
|
|
|
26
26
|
function defaultShouldDehydrateMutation(mutation) {
|
|
27
27
|
return mutation.state.isPaused;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
29
|
function defaultShouldDehydrateQuery(query) {
|
|
31
30
|
return query.state.status === 'success';
|
|
32
31
|
}
|
|
33
|
-
|
|
34
32
|
function dehydrate(client, options = {}) {
|
|
35
33
|
const mutations = [];
|
|
36
34
|
const queries = [];
|
|
@@ -97,6 +95,8 @@ function hydrate(client, dehydratedState, options) {
|
|
|
97
95
|
});
|
|
98
96
|
}
|
|
99
97
|
|
|
98
|
+
exports.defaultShouldDehydrateMutation = defaultShouldDehydrateMutation;
|
|
99
|
+
exports.defaultShouldDehydrateQuery = defaultShouldDehydrateQuery;
|
|
100
100
|
exports.dehydrate = dehydrate;
|
|
101
101
|
exports.hydrate = hydrate;
|
|
102
102
|
//# sourceMappingURL=hydration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydration.js","sources":["../../src/hydration.ts"],"sourcesContent":["import type { QueryClient } from './queryClient'\nimport type { Query, QueryState } from './query'\nimport type {\n MutationKey,\n MutationOptions,\n QueryKey,\n QueryOptions,\n} from './types'\nimport type { Mutation, MutationState } from './mutation'\n\n// TYPES\n\nexport interface DehydrateOptions {\n dehydrateMutations?: boolean\n dehydrateQueries?: boolean\n shouldDehydrateMutation?: ShouldDehydrateMutationFunction\n shouldDehydrateQuery?: ShouldDehydrateQueryFunction\n}\n\nexport interface HydrateOptions {\n defaultOptions?: {\n queries?: QueryOptions\n mutations?: MutationOptions\n }\n}\n\ninterface DehydratedMutation {\n mutationKey?: MutationKey\n state: MutationState\n}\n\ninterface DehydratedQuery {\n queryHash: string\n queryKey: QueryKey\n state: QueryState\n}\n\nexport interface DehydratedState {\n mutations: DehydratedMutation[]\n queries: DehydratedQuery[]\n}\n\nexport type ShouldDehydrateQueryFunction = (query: Query) => boolean\n\nexport type ShouldDehydrateMutationFunction = (mutation: Mutation) => boolean\n\n// FUNCTIONS\n\nfunction dehydrateMutation(mutation: Mutation): DehydratedMutation {\n return {\n mutationKey: mutation.options.mutationKey,\n state: mutation.state,\n }\n}\n\n// Most config is not dehydrated but instead meant to configure again when\n// consuming the de/rehydrated data, typically with useQuery on the client.\n// Sometimes it might make sense to prefetch data on the server and include\n// in the html-payload, but not consume it on the initial render.\nfunction dehydrateQuery(query: Query): DehydratedQuery {\n return {\n state: query.state,\n queryKey: query.queryKey,\n queryHash: query.queryHash,\n }\n}\n\
|
|
1
|
+
{"version":3,"file":"hydration.js","sources":["../../src/hydration.ts"],"sourcesContent":["import type { QueryClient } from './queryClient'\nimport type { Query, QueryState } from './query'\nimport type {\n MutationKey,\n MutationOptions,\n QueryKey,\n QueryOptions,\n} from './types'\nimport type { Mutation, MutationState } from './mutation'\n\n// TYPES\n\nexport interface DehydrateOptions {\n dehydrateMutations?: boolean\n dehydrateQueries?: boolean\n shouldDehydrateMutation?: ShouldDehydrateMutationFunction\n shouldDehydrateQuery?: ShouldDehydrateQueryFunction\n}\n\nexport interface HydrateOptions {\n defaultOptions?: {\n queries?: QueryOptions\n mutations?: MutationOptions\n }\n}\n\ninterface DehydratedMutation {\n mutationKey?: MutationKey\n state: MutationState\n}\n\ninterface DehydratedQuery {\n queryHash: string\n queryKey: QueryKey\n state: QueryState\n}\n\nexport interface DehydratedState {\n mutations: DehydratedMutation[]\n queries: DehydratedQuery[]\n}\n\nexport type ShouldDehydrateQueryFunction = (query: Query) => boolean\n\nexport type ShouldDehydrateMutationFunction = (mutation: Mutation) => boolean\n\n// FUNCTIONS\n\nfunction dehydrateMutation(mutation: Mutation): DehydratedMutation {\n return {\n mutationKey: mutation.options.mutationKey,\n state: mutation.state,\n }\n}\n\n// Most config is not dehydrated but instead meant to configure again when\n// consuming the de/rehydrated data, typically with useQuery on the client.\n// Sometimes it might make sense to prefetch data on the server and include\n// in the html-payload, but not consume it on the initial render.\nfunction dehydrateQuery(query: Query): DehydratedQuery {\n return {\n state: query.state,\n queryKey: query.queryKey,\n queryHash: query.queryHash,\n }\n}\n\nexport function defaultShouldDehydrateMutation(mutation: Mutation) {\n return mutation.state.isPaused\n}\n\nexport function defaultShouldDehydrateQuery(query: Query) {\n return query.state.status === 'success'\n}\n\nexport function dehydrate(\n client: QueryClient,\n options: DehydrateOptions = {},\n): DehydratedState {\n const mutations: DehydratedMutation[] = []\n const queries: DehydratedQuery[] = []\n\n if (options.dehydrateMutations !== false) {\n const shouldDehydrateMutation =\n options.shouldDehydrateMutation || defaultShouldDehydrateMutation\n\n client\n .getMutationCache()\n .getAll()\n .forEach((mutation) => {\n if (shouldDehydrateMutation(mutation)) {\n mutations.push(dehydrateMutation(mutation))\n }\n })\n }\n\n if (options.dehydrateQueries !== false) {\n const shouldDehydrateQuery =\n options.shouldDehydrateQuery || defaultShouldDehydrateQuery\n\n client\n .getQueryCache()\n .getAll()\n .forEach((query) => {\n if (shouldDehydrateQuery(query)) {\n queries.push(dehydrateQuery(query))\n }\n })\n }\n\n return { mutations, queries }\n}\n\nexport function hydrate(\n client: QueryClient,\n dehydratedState: unknown,\n options?: HydrateOptions,\n): void {\n if (typeof dehydratedState !== 'object' || dehydratedState === null) {\n return\n }\n\n const mutationCache = client.getMutationCache()\n const queryCache = client.getQueryCache()\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const mutations = (dehydratedState as DehydratedState).mutations || []\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = (dehydratedState as DehydratedState).queries || []\n\n mutations.forEach((dehydratedMutation) => {\n mutationCache.build(\n client,\n {\n ...options?.defaultOptions?.mutations,\n mutationKey: dehydratedMutation.mutationKey,\n },\n dehydratedMutation.state,\n )\n })\n\n queries.forEach((dehydratedQuery) => {\n const query = queryCache.get(dehydratedQuery.queryHash)\n\n // Do not hydrate if an existing query exists with newer data\n if (query) {\n if (query.state.dataUpdatedAt < dehydratedQuery.state.dataUpdatedAt) {\n query.setState(dehydratedQuery.state)\n }\n return\n }\n\n // Restore query\n queryCache.build(\n client,\n {\n ...options?.defaultOptions?.queries,\n queryKey: dehydratedQuery.queryKey,\n queryHash: dehydratedQuery.queryHash,\n },\n dehydratedQuery.state,\n )\n })\n}\n"],"names":["dehydrateMutation","mutation","mutationKey","options","state","dehydrateQuery","query","queryKey","queryHash","defaultShouldDehydrateMutation","isPaused","defaultShouldDehydrateQuery","status","dehydrate","client","mutations","queries","dehydrateMutations","shouldDehydrateMutation","getMutationCache","getAll","forEach","push","dehydrateQueries","shouldDehydrateQuery","getQueryCache","hydrate","dehydratedState","mutationCache","queryCache","dehydratedMutation","build","defaultOptions","dehydratedQuery","get","dataUpdatedAt","setState"],"mappings":";;;;AAUA;AAoCA;AAEA,SAASA,iBAAT,CAA2BC,QAA3B,EAAmE;EACjE,OAAO;AACLC,IAAAA,WAAW,EAAED,QAAQ,CAACE,OAAT,CAAiBD,WADzB;IAELE,KAAK,EAAEH,QAAQ,CAACG,KAAAA;GAFlB,CAAA;AAID;AAGD;AACA;AACA;;;AACA,SAASC,cAAT,CAAwBC,KAAxB,EAAuD;EACrD,OAAO;IACLF,KAAK,EAAEE,KAAK,CAACF,KADR;IAELG,QAAQ,EAAED,KAAK,CAACC,QAFX;IAGLC,SAAS,EAAEF,KAAK,CAACE,SAAAA;GAHnB,CAAA;AAKD,CAAA;;AAEM,SAASC,8BAAT,CAAwCR,QAAxC,EAA4D;AACjE,EAAA,OAAOA,QAAQ,CAACG,KAAT,CAAeM,QAAtB,CAAA;AACD,CAAA;AAEM,SAASC,2BAAT,CAAqCL,KAArC,EAAmD;AACxD,EAAA,OAAOA,KAAK,CAACF,KAAN,CAAYQ,MAAZ,KAAuB,SAA9B,CAAA;AACD,CAAA;AAEM,SAASC,SAAT,CACLC,MADK,EAELX,OAAyB,GAAG,EAFvB,EAGY;EACjB,MAAMY,SAA+B,GAAG,EAAxC,CAAA;EACA,MAAMC,OAA0B,GAAG,EAAnC,CAAA;;AAEA,EAAA,IAAIb,OAAO,CAACc,kBAAR,KAA+B,KAAnC,EAA0C;AACxC,IAAA,MAAMC,uBAAuB,GAC3Bf,OAAO,CAACe,uBAAR,IAAmCT,8BADrC,CAAA;IAGAK,MAAM,CACHK,gBADH,EAEGC,CAAAA,MAFH,GAGGC,OAHH,CAGYpB,QAAD,IAAc;AACrB,MAAA,IAAIiB,uBAAuB,CAACjB,QAAD,CAA3B,EAAuC;AACrCc,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cAAZ,KAAG,IAAA,GAAA,KAAA,CAAA,GAAA,qBAAA,CAAyBjB,SAA5B,CADF;MAEEb,WAAW,EAAE4B,kBAAkB,CAAC5B,WAAAA;KAJpC,EAME4B,kBAAkB,CAAC1B,KANrB,CAAA,CAAA;GADF,CAAA,CAAA;AAWAY,EAAAA,OAAO,CAACK,OAAR,CAAiBY,eAAD,IAAqB;AAAA,IAAA,IAAA,sBAAA,CAAA;;IACnC,MAAM3B,KAAK,GAAGuB,UAAU,CAACK,GAAX,CAAeD,eAAe,CAACzB,SAA/B,CAAd,CADmC;;AAInC,IAAA,IAAIF,KAAJ,EAAW;MACT,IAAIA,KAAK,CAACF,KAAN,CAAY+B,aAAZ,GAA4BF,eAAe,CAAC7B,KAAhB,CAAsB+B,aAAtD,EAAqE;AACnE7B,QAAAA,KAAK,CAAC8B,QAAN,CAAeH,eAAe,CAAC7B,KAA/B,CAAA,CAAA;AACD,OAAA;;AACD,MAAA,OAAA;AACD,KATkC;;;AAYnCyB,IAAAA,UAAU,CAACE,KAAX,CACEjB,MADF,EAEE,EACE,IAAGX,OAAH,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,CAAA,sBAAA,GAAGA,OAAO,CAAE6B,cAAZ,KAAG,IAAA,GAAA,KAAA,CAAA,GAAA,sBAAA,CAAyBhB,OAA5B,CADF;MAEET,QAAQ,EAAE0B,eAAe,CAAC1B,QAF5B;MAGEC,SAAS,EAAEyB,eAAe,CAACzB,SAAAA;KAL/B,EAOEyB,eAAe,CAAC7B,KAPlB,CAAA,CAAA;GAZF,CAAA,CAAA;AAsBD;;;;;;;"}
|
package/build/lib/hydration.mjs
CHANGED
|
@@ -22,11 +22,9 @@ function dehydrateQuery(query) {
|
|
|
22
22
|
function defaultShouldDehydrateMutation(mutation) {
|
|
23
23
|
return mutation.state.isPaused;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
function defaultShouldDehydrateQuery(query) {
|
|
27
26
|
return query.state.status === 'success';
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
function dehydrate(client, options = {}) {
|
|
31
29
|
const mutations = [];
|
|
32
30
|
const queries = [];
|
|
@@ -93,5 +91,5 @@ function hydrate(client, dehydratedState, options) {
|
|
|
93
91
|
});
|
|
94
92
|
}
|
|
95
93
|
|
|
96
|
-
export { dehydrate, hydrate };
|
|
94
|
+
export { defaultShouldDehydrateMutation, defaultShouldDehydrateQuery, dehydrate, hydrate };
|
|
97
95
|
//# sourceMappingURL=hydration.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydration.mjs","sources":["../../src/hydration.ts"],"sourcesContent":["import type { QueryClient } from './queryClient'\nimport type { Query, QueryState } from './query'\nimport type {\n MutationKey,\n MutationOptions,\n QueryKey,\n QueryOptions,\n} from './types'\nimport type { Mutation, MutationState } from './mutation'\n\n// TYPES\n\nexport interface DehydrateOptions {\n dehydrateMutations?: boolean\n dehydrateQueries?: boolean\n shouldDehydrateMutation?: ShouldDehydrateMutationFunction\n shouldDehydrateQuery?: ShouldDehydrateQueryFunction\n}\n\nexport interface HydrateOptions {\n defaultOptions?: {\n queries?: QueryOptions\n mutations?: MutationOptions\n }\n}\n\ninterface DehydratedMutation {\n mutationKey?: MutationKey\n state: MutationState\n}\n\ninterface DehydratedQuery {\n queryHash: string\n queryKey: QueryKey\n state: QueryState\n}\n\nexport interface DehydratedState {\n mutations: DehydratedMutation[]\n queries: DehydratedQuery[]\n}\n\nexport type ShouldDehydrateQueryFunction = (query: Query) => boolean\n\nexport type ShouldDehydrateMutationFunction = (mutation: Mutation) => boolean\n\n// FUNCTIONS\n\nfunction dehydrateMutation(mutation: Mutation): DehydratedMutation {\n return {\n mutationKey: mutation.options.mutationKey,\n state: mutation.state,\n }\n}\n\n// Most config is not dehydrated but instead meant to configure again when\n// consuming the de/rehydrated data, typically with useQuery on the client.\n// Sometimes it might make sense to prefetch data on the server and include\n// in the html-payload, but not consume it on the initial render.\nfunction dehydrateQuery(query: Query): DehydratedQuery {\n return {\n state: query.state,\n queryKey: query.queryKey,\n queryHash: query.queryHash,\n }\n}\n\
|
|
1
|
+
{"version":3,"file":"hydration.mjs","sources":["../../src/hydration.ts"],"sourcesContent":["import type { QueryClient } from './queryClient'\nimport type { Query, QueryState } from './query'\nimport type {\n MutationKey,\n MutationOptions,\n QueryKey,\n QueryOptions,\n} from './types'\nimport type { Mutation, MutationState } from './mutation'\n\n// TYPES\n\nexport interface DehydrateOptions {\n dehydrateMutations?: boolean\n dehydrateQueries?: boolean\n shouldDehydrateMutation?: ShouldDehydrateMutationFunction\n shouldDehydrateQuery?: ShouldDehydrateQueryFunction\n}\n\nexport interface HydrateOptions {\n defaultOptions?: {\n queries?: QueryOptions\n mutations?: MutationOptions\n }\n}\n\ninterface DehydratedMutation {\n mutationKey?: MutationKey\n state: MutationState\n}\n\ninterface DehydratedQuery {\n queryHash: string\n queryKey: QueryKey\n state: QueryState\n}\n\nexport interface DehydratedState {\n mutations: DehydratedMutation[]\n queries: DehydratedQuery[]\n}\n\nexport type ShouldDehydrateQueryFunction = (query: Query) => boolean\n\nexport type ShouldDehydrateMutationFunction = (mutation: Mutation) => boolean\n\n// FUNCTIONS\n\nfunction dehydrateMutation(mutation: Mutation): DehydratedMutation {\n return {\n mutationKey: mutation.options.mutationKey,\n state: mutation.state,\n }\n}\n\n// Most config is not dehydrated but instead meant to configure again when\n// consuming the de/rehydrated data, typically with useQuery on the client.\n// Sometimes it might make sense to prefetch data on the server and include\n// in the html-payload, but not consume it on the initial render.\nfunction dehydrateQuery(query: Query): DehydratedQuery {\n return {\n state: query.state,\n queryKey: query.queryKey,\n queryHash: query.queryHash,\n }\n}\n\nexport function defaultShouldDehydrateMutation(mutation: Mutation) {\n return mutation.state.isPaused\n}\n\nexport function defaultShouldDehydrateQuery(query: Query) {\n return query.state.status === 'success'\n}\n\nexport function dehydrate(\n client: QueryClient,\n options: DehydrateOptions = {},\n): DehydratedState {\n const mutations: DehydratedMutation[] = []\n const queries: DehydratedQuery[] = []\n\n if (options.dehydrateMutations !== false) {\n const shouldDehydrateMutation =\n options.shouldDehydrateMutation || defaultShouldDehydrateMutation\n\n client\n .getMutationCache()\n .getAll()\n .forEach((mutation) => {\n if (shouldDehydrateMutation(mutation)) {\n mutations.push(dehydrateMutation(mutation))\n }\n })\n }\n\n if (options.dehydrateQueries !== false) {\n const shouldDehydrateQuery =\n options.shouldDehydrateQuery || defaultShouldDehydrateQuery\n\n client\n .getQueryCache()\n .getAll()\n .forEach((query) => {\n if (shouldDehydrateQuery(query)) {\n queries.push(dehydrateQuery(query))\n }\n })\n }\n\n return { mutations, queries }\n}\n\nexport function hydrate(\n client: QueryClient,\n dehydratedState: unknown,\n options?: HydrateOptions,\n): void {\n if (typeof dehydratedState !== 'object' || dehydratedState === null) {\n return\n }\n\n const mutationCache = client.getMutationCache()\n const queryCache = client.getQueryCache()\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const mutations = (dehydratedState as DehydratedState).mutations || []\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = (dehydratedState as DehydratedState).queries || []\n\n mutations.forEach((dehydratedMutation) => {\n mutationCache.build(\n client,\n {\n ...options?.defaultOptions?.mutations,\n mutationKey: dehydratedMutation.mutationKey,\n },\n dehydratedMutation.state,\n )\n })\n\n queries.forEach((dehydratedQuery) => {\n const query = queryCache.get(dehydratedQuery.queryHash)\n\n // Do not hydrate if an existing query exists with newer data\n if (query) {\n if (query.state.dataUpdatedAt < dehydratedQuery.state.dataUpdatedAt) {\n query.setState(dehydratedQuery.state)\n }\n return\n }\n\n // Restore query\n queryCache.build(\n client,\n {\n ...options?.defaultOptions?.queries,\n queryKey: dehydratedQuery.queryKey,\n queryHash: dehydratedQuery.queryHash,\n },\n dehydratedQuery.state,\n )\n })\n}\n"],"names":["dehydrateMutation","mutation","mutationKey","options","state","dehydrateQuery","query","queryKey","queryHash","defaultShouldDehydrateMutation","isPaused","defaultShouldDehydrateQuery","status","dehydrate","client","mutations","queries","dehydrateMutations","shouldDehydrateMutation","getMutationCache","getAll","forEach","push","dehydrateQueries","shouldDehydrateQuery","getQueryCache","hydrate","dehydratedState","mutationCache","queryCache","dehydratedMutation","build","defaultOptions","dehydratedQuery","get","dataUpdatedAt","setState"],"mappings":"AAUA;AAoCA;AAEA,SAASA,iBAAT,CAA2BC,QAA3B,EAAmE;EACjE,OAAO;AACLC,IAAAA,WAAW,EAAED,QAAQ,CAACE,OAAT,CAAiBD,WADzB;IAELE,KAAK,EAAEH,QAAQ,CAACG,KAAAA;GAFlB,CAAA;AAID;AAGD;AACA;AACA;;;AACA,SAASC,cAAT,CAAwBC,KAAxB,EAAuD;EACrD,OAAO;IACLF,KAAK,EAAEE,KAAK,CAACF,KADR;IAELG,QAAQ,EAAED,KAAK,CAACC,QAFX;IAGLC,SAAS,EAAEF,KAAK,CAACE,SAAAA;GAHnB,CAAA;AAKD,CAAA;;AAEM,SAASC,8BAAT,CAAwCR,QAAxC,EAA4D;AACjE,EAAA,OAAOA,QAAQ,CAACG,KAAT,CAAeM,QAAtB,CAAA;AACD,CAAA;AAEM,SAASC,2BAAT,CAAqCL,KAArC,EAAmD;AACxD,EAAA,OAAOA,KAAK,CAACF,KAAN,CAAYQ,MAAZ,KAAuB,SAA9B,CAAA;AACD,CAAA;AAEM,SAASC,SAAT,CACLC,MADK,EAELX,OAAyB,GAAG,EAFvB,EAGY;EACjB,MAAMY,SAA+B,GAAG,EAAxC,CAAA;EACA,MAAMC,OAA0B,GAAG,EAAnC,CAAA;;AAEA,EAAA,IAAIb,OAAO,CAACc,kBAAR,KAA+B,KAAnC,EAA0C;AACxC,IAAA,MAAMC,uBAAuB,GAC3Bf,OAAO,CAACe,uBAAR,IAAmCT,8BADrC,CAAA;IAGAK,MAAM,CACHK,gBADH,EAEGC,CAAAA,MAFH,GAGGC,OAHH,CAGYpB,QAAD,IAAc;AACrB,MAAA,IAAIiB,uBAAuB,CAACjB,QAAD,CAA3B,EAAuC;AACrCc,QAAAA,SAAS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,IAAA,GAAA,KAAA,CAAA,GAAA,qBAAA,CAAyBjB,SAA5B,CADF;MAEEb,WAAW,EAAE4B,kBAAkB,CAAC5B,WAAAA;KAJpC,EAME4B,kBAAkB,CAAC1B,KANrB,CAAA,CAAA;GADF,CAAA,CAAA;AAWAY,EAAAA,OAAO,CAACK,OAAR,CAAiBY,eAAD,IAAqB;AAAA,IAAA,IAAA,sBAAA,CAAA;;IACnC,MAAM3B,KAAK,GAAGuB,UAAU,CAACK,GAAX,CAAeD,eAAe,CAACzB,SAA/B,CAAd,CADmC;;AAInC,IAAA,IAAIF,KAAJ,EAAW;MACT,IAAIA,KAAK,CAACF,KAAN,CAAY+B,aAAZ,GAA4BF,eAAe,CAAC7B,KAAhB,CAAsB+B,aAAtD,EAAqE;AACnE7B,QAAAA,KAAK,CAAC8B,QAAN,CAAeH,eAAe,CAAC7B,KAA/B,CAAA,CAAA;AACD,OAAA;;AACD,MAAA,OAAA;AACD,KATkC;;;AAYnCyB,IAAAA,UAAU,CAACE,KAAX,CACEjB,MADF,EAEE,EACE,IAAGX,OAAH,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,CAAA,sBAAA,GAAGA,OAAO,CAAE6B,cAAZ,KAAG,IAAA,GAAA,KAAA,CAAA,GAAA,sBAAA,CAAyBhB,OAA5B,CADF;MAEET,QAAQ,EAAE0B,eAAe,CAAC1B,QAF5B;MAGEC,SAAS,EAAEyB,eAAe,CAACzB,SAAAA;KAL/B,EAOEyB,eAAe,CAAC7B,KAPlB,CAAA,CAAA;GAZF,CAAA,CAAA;AAsBD;;;;"}
|
package/build/lib/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { onlineManager } from './onlineManager';
|
|
|
12
12
|
export { hashQueryKey, replaceEqualDeep, isError, isServer, parseQueryArgs, parseFilterArgs, parseMutationFilterArgs, parseMutationArgs, } from './utils';
|
|
13
13
|
export type { MutationFilters, QueryFilters, Updater } from './utils';
|
|
14
14
|
export { isCancelledError } from './retryer';
|
|
15
|
-
export { dehydrate, hydrate } from './hydration';
|
|
15
|
+
export { dehydrate, hydrate, defaultShouldDehydrateMutation, defaultShouldDehydrateQuery, } from './hydration';
|
|
16
16
|
export * from './types';
|
|
17
17
|
export type { Query, QueryState } from './query';
|
|
18
18
|
export type { Mutation } from './mutation';
|
package/build/lib/index.esm.js
CHANGED
|
@@ -10,5 +10,5 @@ export { notifyManager } from './notifyManager.esm.js';
|
|
|
10
10
|
export { focusManager } from './focusManager.esm.js';
|
|
11
11
|
export { onlineManager } from './onlineManager.esm.js';
|
|
12
12
|
export { hashQueryKey, isError, isServer, parseFilterArgs, parseMutationArgs, parseMutationFilterArgs, parseQueryArgs, replaceEqualDeep } from './utils.esm.js';
|
|
13
|
-
export { dehydrate, hydrate } from './hydration.esm.js';
|
|
13
|
+
export { defaultShouldDehydrateMutation, defaultShouldDehydrateQuery, dehydrate, hydrate } from './hydration.esm.js';
|
|
14
14
|
//# sourceMappingURL=index.esm.js.map
|
package/build/lib/index.js
CHANGED
|
@@ -38,6 +38,8 @@ exports.parseMutationArgs = utils.parseMutationArgs;
|
|
|
38
38
|
exports.parseMutationFilterArgs = utils.parseMutationFilterArgs;
|
|
39
39
|
exports.parseQueryArgs = utils.parseQueryArgs;
|
|
40
40
|
exports.replaceEqualDeep = utils.replaceEqualDeep;
|
|
41
|
+
exports.defaultShouldDehydrateMutation = hydration.defaultShouldDehydrateMutation;
|
|
42
|
+
exports.defaultShouldDehydrateQuery = hydration.defaultShouldDehydrateQuery;
|
|
41
43
|
exports.dehydrate = hydration.dehydrate;
|
|
42
44
|
exports.hydrate = hydration.hydrate;
|
|
43
45
|
//# sourceMappingURL=index.js.map
|
package/build/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/lib/index.mjs
CHANGED
|
@@ -10,5 +10,5 @@ export { notifyManager } from './notifyManager.mjs';
|
|
|
10
10
|
export { focusManager } from './focusManager.mjs';
|
|
11
11
|
export { onlineManager } from './onlineManager.mjs';
|
|
12
12
|
export { hashQueryKey, isError, isServer, parseFilterArgs, parseMutationArgs, parseMutationFilterArgs, parseQueryArgs, replaceEqualDeep } from './utils.mjs';
|
|
13
|
-
export { dehydrate, hydrate } from './hydration.mjs';
|
|
13
|
+
export { defaultShouldDehydrateMutation, defaultShouldDehydrateQuery, dehydrate, hydrate } from './hydration.mjs';
|
|
14
14
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -3085,11 +3085,9 @@
|
|
|
3085
3085
|
function defaultShouldDehydrateMutation(mutation) {
|
|
3086
3086
|
return mutation.state.isPaused;
|
|
3087
3087
|
}
|
|
3088
|
-
|
|
3089
3088
|
function defaultShouldDehydrateQuery(query) {
|
|
3090
3089
|
return query.state.status === 'success';
|
|
3091
3090
|
}
|
|
3092
|
-
|
|
3093
3091
|
function dehydrate(client, options = {}) {
|
|
3094
3092
|
const mutations = [];
|
|
3095
3093
|
const queries = [];
|
|
@@ -3164,6 +3162,8 @@
|
|
|
3164
3162
|
exports.QueryCache = QueryCache;
|
|
3165
3163
|
exports.QueryClient = QueryClient;
|
|
3166
3164
|
exports.QueryObserver = QueryObserver;
|
|
3165
|
+
exports.defaultShouldDehydrateMutation = defaultShouldDehydrateMutation;
|
|
3166
|
+
exports.defaultShouldDehydrateQuery = defaultShouldDehydrateQuery;
|
|
3167
3167
|
exports.dehydrate = dehydrate;
|
|
3168
3168
|
exports.focusManager = focusManager;
|
|
3169
3169
|
exports.hashQueryKey = hashQueryKey;
|