@tanstack/query-core 5.14.0 → 5.14.2

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 (92) 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.cjs.map +1 -1
  4. package/build/legacy/index.d.cts +1 -1
  5. package/build/legacy/index.d.ts +1 -1
  6. package/build/legacy/index.js.map +1 -1
  7. package/build/legacy/infiniteQueryBehavior.d.cts +1 -1
  8. package/build/legacy/infiniteQueryBehavior.d.ts +1 -1
  9. package/build/legacy/infiniteQueryObserver.d.cts +1 -1
  10. package/build/legacy/infiniteQueryObserver.d.ts +1 -1
  11. package/build/legacy/mutation.cjs.map +1 -1
  12. package/build/legacy/mutation.d.cts +1 -1
  13. package/build/legacy/mutation.d.ts +1 -1
  14. package/build/legacy/mutation.js.map +1 -1
  15. package/build/legacy/mutationCache.cjs.map +1 -1
  16. package/build/legacy/mutationCache.d.cts +1 -1
  17. package/build/legacy/mutationCache.d.ts +1 -1
  18. package/build/legacy/mutationCache.js.map +1 -1
  19. package/build/legacy/mutationObserver.cjs +7 -21
  20. package/build/legacy/mutationObserver.cjs.map +1 -1
  21. package/build/legacy/mutationObserver.d.cts +1 -1
  22. package/build/legacy/mutationObserver.d.ts +1 -1
  23. package/build/legacy/mutationObserver.js +7 -21
  24. package/build/legacy/mutationObserver.js.map +1 -1
  25. package/build/legacy/queriesObserver.d.cts +1 -1
  26. package/build/legacy/queriesObserver.d.ts +1 -1
  27. package/build/legacy/query.d.cts +1 -1
  28. package/build/legacy/query.d.ts +1 -1
  29. package/build/legacy/queryCache.d.cts +1 -1
  30. package/build/legacy/queryCache.d.ts +1 -1
  31. package/build/legacy/{queryClient-N0XKecPj.d.ts → queryClient-iw7Hbrkm.d.ts} +2 -2
  32. package/build/legacy/{queryClient-UnTFzrI2.d.ts → queryClient-qZFrH27l.d.ts} +2 -2
  33. package/build/legacy/queryClient.d.cts +1 -1
  34. package/build/legacy/queryClient.d.ts +1 -1
  35. package/build/legacy/queryObserver.d.cts +1 -1
  36. package/build/legacy/queryObserver.d.ts +1 -1
  37. package/build/legacy/retryer.d.cts +1 -1
  38. package/build/legacy/retryer.d.ts +1 -1
  39. package/build/legacy/types.cjs.map +1 -1
  40. package/build/legacy/types.d.cts +1 -1
  41. package/build/legacy/types.d.ts +1 -1
  42. package/build/legacy/utils.d.cts +1 -1
  43. package/build/legacy/utils.d.ts +1 -1
  44. package/build/modern/hydration.d.cts +1 -1
  45. package/build/modern/hydration.d.ts +1 -1
  46. package/build/modern/index.cjs.map +1 -1
  47. package/build/modern/index.d.cts +1 -1
  48. package/build/modern/index.d.ts +1 -1
  49. package/build/modern/index.js.map +1 -1
  50. package/build/modern/infiniteQueryBehavior.d.cts +1 -1
  51. package/build/modern/infiniteQueryBehavior.d.ts +1 -1
  52. package/build/modern/infiniteQueryObserver.d.cts +1 -1
  53. package/build/modern/infiniteQueryObserver.d.ts +1 -1
  54. package/build/modern/mutation.cjs.map +1 -1
  55. package/build/modern/mutation.d.cts +1 -1
  56. package/build/modern/mutation.d.ts +1 -1
  57. package/build/modern/mutation.js.map +1 -1
  58. package/build/modern/mutationCache.cjs.map +1 -1
  59. package/build/modern/mutationCache.d.cts +1 -1
  60. package/build/modern/mutationCache.d.ts +1 -1
  61. package/build/modern/mutationCache.js.map +1 -1
  62. package/build/modern/mutationObserver.cjs +7 -18
  63. package/build/modern/mutationObserver.cjs.map +1 -1
  64. package/build/modern/mutationObserver.d.cts +1 -1
  65. package/build/modern/mutationObserver.d.ts +1 -1
  66. package/build/modern/mutationObserver.js +7 -18
  67. package/build/modern/mutationObserver.js.map +1 -1
  68. package/build/modern/queriesObserver.d.cts +1 -1
  69. package/build/modern/queriesObserver.d.ts +1 -1
  70. package/build/modern/query.d.cts +1 -1
  71. package/build/modern/query.d.ts +1 -1
  72. package/build/modern/queryCache.d.cts +1 -1
  73. package/build/modern/queryCache.d.ts +1 -1
  74. package/build/modern/{queryClient-N0XKecPj.d.ts → queryClient-iw7Hbrkm.d.ts} +2 -2
  75. package/build/modern/{queryClient-UnTFzrI2.d.ts → queryClient-qZFrH27l.d.ts} +2 -2
  76. package/build/modern/queryClient.d.cts +1 -1
  77. package/build/modern/queryClient.d.ts +1 -1
  78. package/build/modern/queryObserver.d.cts +1 -1
  79. package/build/modern/queryObserver.d.ts +1 -1
  80. package/build/modern/retryer.d.cts +1 -1
  81. package/build/modern/retryer.d.ts +1 -1
  82. package/build/modern/types.cjs.map +1 -1
  83. package/build/modern/types.d.cts +1 -1
  84. package/build/modern/types.d.ts +1 -1
  85. package/build/modern/utils.d.cts +1 -1
  86. package/build/modern/utils.d.ts +1 -1
  87. package/package.json +1 -1
  88. package/src/index.ts +1 -0
  89. package/src/mutation.ts +1 -1
  90. package/src/mutationCache.ts +1 -1
  91. package/src/mutationObserver.ts +8 -18
  92. package/src/types.ts +1 -1
@@ -1,3 +1,3 @@
1
- export { e as MutationFilters, f as QueryFilters, aH as QueryTypeFilter, U as Updater, aV as addToEnd, aW as addToStart, aJ as functionalUpdate, h as hashKey, aN as hashQueryKeyByOptions, aQ as isPlainArray, aR as isPlainObject, i as isServer, aK as isValidTimeout, k as keepPreviousData, aM as matchMutation, m as matchQuery, aI as noop, aO as partialMatchKey, aU as replaceData, r as replaceEqualDeep, aT as scheduleMicrotask, aP as shallowEqualObjects, aS as sleep, aL as timeUntilStale } from './queryClient-UnTFzrI2.js';
1
+ export { f as MutationFilters, g as QueryFilters, aI as QueryTypeFilter, U as Updater, aW as addToEnd, aX as addToStart, aK as functionalUpdate, h as hashKey, aO as hashQueryKeyByOptions, aR as isPlainArray, aS as isPlainObject, i as isServer, aL as isValidTimeout, k as keepPreviousData, aN as matchMutation, m as matchQuery, aJ as noop, aP as partialMatchKey, aV as replaceData, r as replaceEqualDeep, aU as scheduleMicrotask, aQ as shallowEqualObjects, aT as sleep, aM as timeUntilStale } from './queryClient-qZFrH27l.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.14.0",
3
+ "version": "5.14.2",
4
4
  "description": "The framework agnostic core that powers TanStack Query",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ export { QueryObserver } from './queryObserver'
8
8
  export { QueriesObserver } from './queriesObserver'
9
9
  export { InfiniteQueryObserver } from './infiniteQueryObserver'
10
10
  export { MutationCache } from './mutationCache'
11
+ export type { MutationCacheNotifyEvent } from './mutationCache'
11
12
  export { MutationObserver } from './mutationObserver'
12
13
  export { notifyManager } from './notifyManager'
13
14
  export { focusManager } from './focusManager'
package/src/mutation.ts CHANGED
@@ -218,7 +218,7 @@ export class Mutation<
218
218
  this as Mutation<unknown, unknown, unknown, unknown>,
219
219
  )
220
220
 
221
- await this.options.onSuccess?.(data, variables, this.state.context)
221
+ await this.options.onSuccess?.(data, variables, this.state.context!)
222
222
 
223
223
  // Notify cache callback
224
224
  await this.#mutationCache.config.onSettled?.(
@@ -69,7 +69,7 @@ interface NotifyEventMutationUpdated extends NotifyEvent {
69
69
  action: Action<any, any, any, any>
70
70
  }
71
71
 
72
- type MutationCacheNotifyEvent =
72
+ export type MutationCacheNotifyEvent =
73
73
  | NotifyEventMutationAdded
74
74
  | NotifyEventMutationRemoved
75
75
  | NotifyEventMutationObserverAdded
@@ -144,29 +144,19 @@ export class MutationObserver<
144
144
  notifyManager.batch(() => {
145
145
  // First trigger the mutate callbacks
146
146
  if (this.#mutateOptions && this.hasListeners()) {
147
+ const variables = this.#currentResult.variables!
148
+ const context = this.#currentResult.context
149
+
147
150
  if (action?.type === 'success') {
148
- this.#mutateOptions.onSuccess?.(
149
- action.data,
150
- this.#currentResult.variables!,
151
- this.#currentResult.context!,
152
- )
153
- this.#mutateOptions.onSettled?.(
154
- action.data,
155
- null,
156
- this.#currentResult.variables!,
157
- this.#currentResult.context,
158
- )
151
+ this.#mutateOptions.onSuccess?.(action.data, variables, context!)
152
+ this.#mutateOptions.onSettled?.(action.data, null, variables, context)
159
153
  } else if (action?.type === 'error') {
160
- this.#mutateOptions.onError?.(
161
- action.error,
162
- this.#currentResult.variables!,
163
- this.#currentResult.context,
164
- )
154
+ this.#mutateOptions.onError?.(action.error, variables, context)
165
155
  this.#mutateOptions.onSettled?.(
166
156
  undefined,
167
157
  action.error,
168
- this.#currentResult.variables!,
169
- this.#currentResult.context,
158
+ variables,
159
+ context,
170
160
  )
171
161
  }
172
162
  }
package/src/types.ts CHANGED
@@ -671,7 +671,7 @@ export interface MutationOptions<
671
671
  onSuccess?: (
672
672
  data: TData,
673
673
  variables: TVariables,
674
- context: TContext | undefined,
674
+ context: TContext,
675
675
  ) => Promise<unknown> | unknown
676
676
  onError?: (
677
677
  error: TError,