@tanstack/query-core 5.0.0-alpha.90 → 5.0.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.
Files changed (77) hide show
  1. package/build/legacy/hydration.d.cts +1 -1
  2. package/build/legacy/hydration.d.ts +1 -1
  3. package/build/legacy/index.d.cts +1 -1
  4. package/build/legacy/index.d.ts +1 -1
  5. package/build/legacy/infiniteQueryBehavior.d.cts +1 -1
  6. package/build/legacy/infiniteQueryBehavior.d.ts +1 -1
  7. package/build/legacy/infiniteQueryObserver.d.cts +1 -1
  8. package/build/legacy/infiniteQueryObserver.d.ts +1 -1
  9. package/build/legacy/mutation.d.cts +1 -1
  10. package/build/legacy/mutation.d.ts +1 -1
  11. package/build/legacy/mutationCache.d.cts +1 -1
  12. package/build/legacy/mutationCache.d.ts +1 -1
  13. package/build/legacy/mutationObserver.d.cts +1 -1
  14. package/build/legacy/mutationObserver.d.ts +1 -1
  15. package/build/legacy/queriesObserver.d.cts +1 -1
  16. package/build/legacy/queriesObserver.d.ts +1 -1
  17. package/build/legacy/query.d.cts +1 -1
  18. package/build/legacy/query.d.ts +1 -1
  19. package/build/legacy/queryCache.d.cts +1 -1
  20. package/build/legacy/queryCache.d.ts +1 -1
  21. package/build/legacy/{queryClient-d035cb61.d.ts → queryClient-7060338a.d.ts} +7 -3
  22. package/build/legacy/{queryClient-158dd7f5.d.ts → queryClient-9264ae39.d.ts} +7 -3
  23. package/build/legacy/queryClient.d.cts +1 -1
  24. package/build/legacy/queryClient.d.ts +1 -1
  25. package/build/legacy/queryObserver.cjs +5 -2
  26. package/build/legacy/queryObserver.cjs.map +1 -1
  27. package/build/legacy/queryObserver.d.cts +1 -1
  28. package/build/legacy/queryObserver.d.ts +1 -1
  29. package/build/legacy/queryObserver.js +5 -2
  30. package/build/legacy/queryObserver.js.map +1 -1
  31. package/build/legacy/retryer.d.cts +1 -1
  32. package/build/legacy/retryer.d.ts +1 -1
  33. package/build/legacy/types.cjs.map +1 -1
  34. package/build/legacy/types.d.cts +1 -1
  35. package/build/legacy/types.d.ts +1 -1
  36. package/build/legacy/utils.d.cts +1 -1
  37. package/build/legacy/utils.d.ts +1 -1
  38. package/build/modern/hydration.d.cts +1 -1
  39. package/build/modern/hydration.d.ts +1 -1
  40. package/build/modern/index.d.cts +1 -1
  41. package/build/modern/index.d.ts +1 -1
  42. package/build/modern/infiniteQueryBehavior.d.cts +1 -1
  43. package/build/modern/infiniteQueryBehavior.d.ts +1 -1
  44. package/build/modern/infiniteQueryObserver.d.cts +1 -1
  45. package/build/modern/infiniteQueryObserver.d.ts +1 -1
  46. package/build/modern/mutation.d.cts +1 -1
  47. package/build/modern/mutation.d.ts +1 -1
  48. package/build/modern/mutationCache.d.cts +1 -1
  49. package/build/modern/mutationCache.d.ts +1 -1
  50. package/build/modern/mutationObserver.d.cts +1 -1
  51. package/build/modern/mutationObserver.d.ts +1 -1
  52. package/build/modern/queriesObserver.d.cts +1 -1
  53. package/build/modern/queriesObserver.d.ts +1 -1
  54. package/build/modern/query.d.cts +1 -1
  55. package/build/modern/query.d.ts +1 -1
  56. package/build/modern/queryCache.d.cts +1 -1
  57. package/build/modern/queryCache.d.ts +1 -1
  58. package/build/modern/{queryClient-d035cb61.d.ts → queryClient-7060338a.d.ts} +7 -3
  59. package/build/modern/{queryClient-158dd7f5.d.ts → queryClient-9264ae39.d.ts} +7 -3
  60. package/build/modern/queryClient.d.cts +1 -1
  61. package/build/modern/queryClient.d.ts +1 -1
  62. package/build/modern/queryObserver.cjs +5 -2
  63. package/build/modern/queryObserver.cjs.map +1 -1
  64. package/build/modern/queryObserver.d.cts +1 -1
  65. package/build/modern/queryObserver.d.ts +1 -1
  66. package/build/modern/queryObserver.js +5 -2
  67. package/build/modern/queryObserver.js.map +1 -1
  68. package/build/modern/retryer.d.cts +1 -1
  69. package/build/modern/retryer.d.ts +1 -1
  70. package/build/modern/types.cjs.map +1 -1
  71. package/build/modern/types.d.cts +1 -1
  72. package/build/modern/types.d.ts +1 -1
  73. package/build/modern/utils.d.cts +1 -1
  74. package/build/modern/utils.d.ts +1 -1
  75. package/package.json +1 -1
  76. package/src/queryObserver.ts +9 -3
  77. package/src/types.ts +9 -3
@@ -1,3 +1,3 @@
1
- export { aC as DataUpdateFunction, e as MutationFilters, f as QueryFilters, aD as QueryTypeFilter, U as Updater, aR as addToEnd, aS as addToStart, aF as functionalUpdate, h as hashKey, aJ as hashQueryKeyByOptions, aM as isPlainArray, aN as isPlainObject, i as isServer, aG as isValidTimeout, k as keepPreviousData, aI as matchMutation, m as matchQuery, aE as noop, aK as partialMatchKey, aQ as replaceData, r as replaceEqualDeep, aP as scheduleMicrotask, aL as shallowEqualObjects, aO as sleep, aH as timeUntilStale } from './queryClient-d035cb61.js';
1
+ export { aD as DataUpdateFunction, e as MutationFilters, f as QueryFilters, aE as QueryTypeFilter, U as Updater, aS as addToEnd, aT as addToStart, aG as functionalUpdate, h as hashKey, aK as hashQueryKeyByOptions, aN as isPlainArray, aO as isPlainObject, i as isServer, aH as isValidTimeout, k as keepPreviousData, aJ as matchMutation, m as matchQuery, aF as noop, aL as partialMatchKey, aR as replaceData, r as replaceEqualDeep, aQ as scheduleMicrotask, aM as shallowEqualObjects, aP as sleep, aI as timeUntilStale } from './queryClient-7060338a.js';
2
2
  import './removable.cjs';
3
3
  import './subscribable.cjs';
@@ -1,3 +1,3 @@
1
- export { aC as DataUpdateFunction, e as MutationFilters, f as QueryFilters, aD as QueryTypeFilter, U as Updater, aR as addToEnd, aS as addToStart, aF as functionalUpdate, h as hashKey, aJ as hashQueryKeyByOptions, aM as isPlainArray, aN as isPlainObject, i as isServer, aG as isValidTimeout, k as keepPreviousData, aI as matchMutation, m as matchQuery, aE as noop, aK as partialMatchKey, aQ as replaceData, r as replaceEqualDeep, aP as scheduleMicrotask, aL as shallowEqualObjects, aO as sleep, aH as timeUntilStale } from './queryClient-158dd7f5.js';
1
+ export { aD as DataUpdateFunction, e as MutationFilters, f as QueryFilters, aE as QueryTypeFilter, U as Updater, aS as addToEnd, aT as addToStart, aG as functionalUpdate, h as hashKey, aK as hashQueryKeyByOptions, aN as isPlainArray, aO as isPlainObject, i as isServer, aH as isValidTimeout, k as keepPreviousData, aJ as matchMutation, m as matchQuery, aF as noop, aL as partialMatchKey, aR as replaceData, r as replaceEqualDeep, aQ as scheduleMicrotask, aM as shallowEqualObjects, aP as sleep, aI as timeUntilStale } from './queryClient-9264ae39.js';
2
2
  import './removable.js';
3
3
  import './subscribable.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/query-core",
3
- "version": "5.0.0-alpha.90",
3
+ "version": "5.0.0-beta.0",
4
4
  "description": "The framework agnostic core that powers TanStack Query",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -612,15 +612,21 @@ export class QueryObserver<
612
612
  }
613
613
 
614
614
  const { notifyOnChangeProps } = this.options
615
+ const notifyOnChangePropsValue =
616
+ typeof notifyOnChangeProps === 'function'
617
+ ? notifyOnChangeProps()
618
+ : notifyOnChangeProps
615
619
 
616
620
  if (
617
- notifyOnChangeProps === 'all' ||
618
- (!notifyOnChangeProps && !this.#trackedProps.size)
621
+ notifyOnChangePropsValue === 'all' ||
622
+ (!notifyOnChangePropsValue && !this.#trackedProps.size)
619
623
  ) {
620
624
  return true
621
625
  }
622
626
 
623
- const includedProps = new Set(notifyOnChangeProps ?? this.#trackedProps)
627
+ const includedProps = new Set(
628
+ notifyOnChangePropsValue ?? this.#trackedProps,
629
+ )
624
630
 
625
631
  if (this.options.throwOnError) {
626
632
  includedProps.add('error')
package/src/types.ts CHANGED
@@ -95,6 +95,11 @@ export type QueryMeta = Register extends {
95
95
 
96
96
  export type NetworkMode = 'online' | 'always' | 'offlineFirst'
97
97
 
98
+ export type NotifyOnChangeProps =
99
+ | Array<keyof InfiniteQueryObserverResult>
100
+ | 'all'
101
+ | (() => Array<keyof InfiniteQueryObserverResult> | 'all')
102
+
98
103
  export interface QueryOptions<
99
104
  TQueryFnData = unknown,
100
105
  TError = DefaultError,
@@ -261,9 +266,10 @@ export interface QueryObserverOptions<
261
266
  * If set, the component will only re-render if any of the listed properties change.
262
267
  * When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change.
263
268
  * When set to `'all'`, the component will re-render whenever a query is updated.
269
+ * When set to a function, the function will be executed to compute the list of properties.
264
270
  * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change.
265
271
  */
266
- notifyOnChangeProps?: Array<keyof InfiniteQueryObserverResult> | 'all'
272
+ notifyOnChangeProps?: NotifyOnChangeProps
267
273
  /**
268
274
  * Whether errors should be thrown instead of setting the `error` property.
269
275
  * If set to `true` or `suspense` is `true`, all errors will be thrown to the error boundary.
@@ -292,8 +298,8 @@ export interface QueryObserverOptions<
292
298
  _optimisticResults?: 'optimistic' | 'isRestoring'
293
299
  }
294
300
 
295
- export type WithRequired<T, K extends keyof T> = Omit<T, K> &
296
- Required<Pick<T, K>>
301
+ export type WithRequired<T, K extends keyof T> = T & { [_ in K]: {} }
302
+
297
303
  export type DefaultedQueryObserverOptions<
298
304
  TQueryFnData = unknown,
299
305
  TError = DefaultError,