@tanstack/query-core 5.0.0-alpha.0 → 5.0.0-alpha.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/query-core",
3
- "version": "5.0.0-alpha.0",
3
+ "version": "5.0.0-alpha.1",
4
4
  "description": "The framework agnostic core that powers TanStack Query",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
package/src/mutation.ts CHANGED
@@ -209,7 +209,7 @@ export class Mutation<
209
209
  this as Mutation<unknown, unknown, unknown, unknown>,
210
210
  )
211
211
 
212
- await this.options.onSuccess?.(data, variables, this.state.context!)
212
+ await this.options.onSuccess?.(data, variables, this.state.context)
213
213
 
214
214
  await this.options.onSettled?.(data, null, variables, this.state.context)
215
215
 
@@ -103,9 +103,7 @@ export class MutationObserver<
103
103
 
104
104
  this.#currentMutation = this.#client
105
105
  .getMutationCache()
106
- .build(this.#client, {
107
- ...this.options,
108
- })
106
+ .build(this.#client, this.options)
109
107
 
110
108
  this.#currentMutation.addObserver(this)
111
109
 
package/src/query.ts CHANGED
@@ -458,7 +458,7 @@ export class Query<
458
458
  return
459
459
  }
460
460
 
461
- this.setData(data as TData)
461
+ this.setData(data)
462
462
 
463
463
  // Notify cache callback
464
464
  this.#cache.config.onSuccess?.(data, this as Query<any, any, any, any>)
@@ -648,10 +648,10 @@ export class QueryObserver<
648
648
  // First trigger the configuration callbacks
649
649
  if (notifyOptions.onSuccess) {
650
650
  this.options.onSuccess?.(this.#currentResult.data!)
651
- this.options.onSettled?.(this.#currentResult.data!, null)
651
+ this.options.onSettled?.(this.#currentResult.data, null)
652
652
  } else if (notifyOptions.onError) {
653
653
  this.options.onError?.(this.#currentResult.error!)
654
- this.options.onSettled?.(undefined, this.#currentResult.error!)
654
+ this.options.onSettled?.(undefined, this.#currentResult.error)
655
655
  }
656
656
 
657
657
  // Then trigger the listeners
@@ -9,7 +9,7 @@ export class Subscribable<TListener extends Function = Listener> {
9
9
  }
10
10
 
11
11
  subscribe(listener: TListener): () => void {
12
- this.listeners.push(listener as TListener)
12
+ this.listeners.push(listener)
13
13
 
14
14
  this.onSubscribe()
15
15