@tanstack/query-core 4.1.3 → 4.3.0-beta.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/{types/packages/query-core/src → lib}/focusManager.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/hydration.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/index.d.ts +2 -2
- package/build/lib/index.js +3115 -0
- package/build/lib/index.js.map +1 -0
- package/build/{esm/index.js → lib/index.mjs} +3 -1
- package/build/lib/index.mjs.map +1 -0
- package/build/{types/packages/query-core/src → lib}/infiniteQueryBehavior.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/infiniteQueryObserver.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/logger.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/logger.native.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/mutation.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/mutationCache.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/mutationObserver.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/notifyManager.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/onlineManager.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/queriesObserver.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/query.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/queryCache.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/queryClient.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/queryObserver.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/removable.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/retryer.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/subscribable.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/types.d.ts +2 -1
- package/build/{types/packages/query-core/src → lib}/utils.d.ts +0 -0
- package/build/umd/index.development.js +2 -0
- 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 +16 -8
- package/src/index.ts +2 -2
- package/src/tests/queryClient.test.tsx +33 -0
- package/src/types.ts +4 -1
- package/src/utils.ts +2 -0
- package/build/cjs/focusManager.js +0 -101
- package/build/cjs/focusManager.js.map +0 -1
- package/build/cjs/hydration.js +0 -112
- package/build/cjs/hydration.js.map +0 -1
- package/build/cjs/index.js +0 -51
- package/build/cjs/index.js.map +0 -1
- package/build/cjs/infiniteQueryBehavior.js +0 -160
- package/build/cjs/infiniteQueryBehavior.js.map +0 -1
- package/build/cjs/infiniteQueryObserver.js +0 -92
- package/build/cjs/infiniteQueryObserver.js.map +0 -1
- package/build/cjs/logger.js +0 -18
- package/build/cjs/logger.js.map +0 -1
- package/build/cjs/mutation.js +0 -258
- package/build/cjs/mutation.js.map +0 -1
- package/build/cjs/mutationCache.js +0 -99
- package/build/cjs/mutationCache.js.map +0 -1
- package/build/cjs/mutationObserver.js +0 -140
- package/build/cjs/mutationObserver.js.map +0 -1
- package/build/cjs/notifyManager.js +0 -114
- package/build/cjs/notifyManager.js.map +0 -1
- package/build/cjs/onlineManager.js +0 -100
- package/build/cjs/onlineManager.js.map +0 -1
- package/build/cjs/queriesObserver.js +0 -170
- package/build/cjs/queriesObserver.js.map +0 -1
- package/build/cjs/query.js +0 -474
- package/build/cjs/query.js.map +0 -1
- package/build/cjs/queryCache.js +0 -140
- package/build/cjs/queryCache.js.map +0 -1
- package/build/cjs/queryClient.js +0 -353
- package/build/cjs/queryClient.js.map +0 -1
- package/build/cjs/queryObserver.js +0 -529
- package/build/cjs/queryObserver.js.map +0 -1
- package/build/cjs/removable.js +0 -47
- package/build/cjs/removable.js.map +0 -1
- package/build/cjs/retryer.js +0 -177
- package/build/cjs/retryer.js.map +0 -1
- package/build/cjs/subscribable.js +0 -43
- package/build/cjs/subscribable.js.map +0 -1
- package/build/cjs/utils.js +0 -356
- package/build/cjs/utils.js.map +0 -1
- package/build/esm/index.js.map +0 -1
- package/build/stats-html.html +0 -2689
- package/build/stats.json +0 -811
- package/build/types/packages/query-core/src/tests/focusManager.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/hydration.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/infiniteQueryBehavior.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/infiniteQueryObserver.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/mutationCache.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/mutationObserver.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/mutations.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/notifyManager.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/onlineManager.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/queriesObserver.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/query.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/queryCache.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/queryClient.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/queryObserver.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/utils.test.d.ts +0 -1
- package/build/types/tests/utils.d.ts +0 -24
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -45,9 +45,10 @@ export interface QueryOptions<TQueryFnData = unknown, TError = unknown, TData =
|
|
|
45
45
|
behavior?: QueryBehavior<TQueryFnData, TError, TData>;
|
|
46
46
|
/**
|
|
47
47
|
* Set this to `false` to disable structural sharing between query results.
|
|
48
|
+
* Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom structural sharing logic.
|
|
48
49
|
* Defaults to `true`.
|
|
49
50
|
*/
|
|
50
|
-
structuralSharing?: boolean;
|
|
51
|
+
structuralSharing?: boolean | ((oldData: TData | undefined, newData: TData) => TData);
|
|
51
52
|
/**
|
|
52
53
|
* This function can be set to automatically get the previous cursor for infinite queries.
|
|
53
54
|
* The result will also be used to determine the value of `hasPreviousPage`.
|
|
File without changes
|
|
@@ -347,6 +347,8 @@
|
|
|
347
347
|
// Use prev data if an isDataEqual function is defined and returns `true`
|
|
348
348
|
if (options.isDataEqual != null && options.isDataEqual(prevData, data)) {
|
|
349
349
|
return prevData;
|
|
350
|
+
} else if (typeof options.structuralSharing === 'function') {
|
|
351
|
+
return options.structuralSharing(prevData, data);
|
|
350
352
|
} else if (options.structuralSharing !== false) {
|
|
351
353
|
// Structurally share data between prev and new data if needed
|
|
352
354
|
return replaceEqualDeep(prevData, data);
|