@tanstack/query-core 4.29.25 → 4.30.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/queryObserver.d.ts.map +1 -1
- package/build/lib/queryObserver.esm.js +3 -2
- package/build/lib/queryObserver.esm.js.map +1 -1
- package/build/lib/queryObserver.js +3 -2
- package/build/lib/queryObserver.js.map +1 -1
- package/build/lib/queryObserver.mjs +3 -2
- package/build/lib/queryObserver.mjs.map +1 -1
- package/build/lib/types.d.ts +3 -1
- package/build/lib/types.d.ts.map +1 -1
- package/build/umd/index.development.js +3 -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/queryObserver.ts +9 -3
- package/src/types.ts +7 -1
package/package.json
CHANGED
package/src/queryObserver.ts
CHANGED
|
@@ -637,15 +637,21 @@ export class QueryObserver<
|
|
|
637
637
|
}
|
|
638
638
|
|
|
639
639
|
const { notifyOnChangeProps } = this.options
|
|
640
|
+
const notifyOnChangePropsValue =
|
|
641
|
+
typeof notifyOnChangeProps === 'function'
|
|
642
|
+
? notifyOnChangeProps()
|
|
643
|
+
: notifyOnChangeProps
|
|
640
644
|
|
|
641
645
|
if (
|
|
642
|
-
|
|
643
|
-
(!
|
|
646
|
+
notifyOnChangePropsValue === 'all' ||
|
|
647
|
+
(!notifyOnChangePropsValue && !this.trackedProps.size)
|
|
644
648
|
) {
|
|
645
649
|
return true
|
|
646
650
|
}
|
|
647
651
|
|
|
648
|
-
const includedProps = new Set(
|
|
652
|
+
const includedProps = new Set(
|
|
653
|
+
notifyOnChangePropsValue ?? this.trackedProps,
|
|
654
|
+
)
|
|
649
655
|
|
|
650
656
|
if (this.options.useErrorBoundary) {
|
|
651
657
|
includedProps.add('error')
|
package/src/types.ts
CHANGED
|
@@ -55,6 +55,11 @@ export interface QueryMeta {
|
|
|
55
55
|
|
|
56
56
|
export type NetworkMode = 'online' | 'always' | 'offlineFirst'
|
|
57
57
|
|
|
58
|
+
export type NotifyOnChangeProps =
|
|
59
|
+
| Array<keyof InfiniteQueryObserverResult>
|
|
60
|
+
| 'all'
|
|
61
|
+
| (() => Array<keyof InfiniteQueryObserverResult> | 'all')
|
|
62
|
+
|
|
58
63
|
export interface QueryOptions<
|
|
59
64
|
TQueryFnData = unknown,
|
|
60
65
|
TError = unknown,
|
|
@@ -200,9 +205,10 @@ export interface QueryObserverOptions<
|
|
|
200
205
|
* If set, the component will only re-render if any of the listed properties change.
|
|
201
206
|
* When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change.
|
|
202
207
|
* When set to `'all'`, the component will re-render whenever a query is updated.
|
|
208
|
+
* When set to a function, the function will be executed to compute the list of properties.
|
|
203
209
|
* By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change.
|
|
204
210
|
*/
|
|
205
|
-
notifyOnChangeProps?:
|
|
211
|
+
notifyOnChangeProps?: NotifyOnChangeProps
|
|
206
212
|
/**
|
|
207
213
|
* This callback will fire any time the query successfully fetches new data.
|
|
208
214
|
*
|