Skip to content
Source
Sign inSign up
TanStack/query

fix: move thenable-recreation into createResult #8169

MergedTkDodomerged 4 commits intomain fromrefs/pull/8169/headmerged by TkDodo View on GitHub

Showing 4 changed files with 123 additions and 22 deletions (loading 1).

x
0 of 4 viewed, 4 left
23 additions and 21 deletionspackages/query-core/src/queryObserver.tsModified
View file
@@ -594,28 +594,8 @@
promise: this.#currentThenable,
​
- return result as QueryObserverResult<TData, TError>
- }
+ const nextResult = result as QueryObserverResult<TData, TError>
​
- updateResult(notifyOptions?: NotifyOptions): void {
- const prevResult = this.#currentResult as
- | QueryObserverResult<TData, TError>
- | undefined
-​
- const nextResult = this.createResult(this.#currentQuery, this.options)
-​
- this.#currentResultState = this.#currentQuery.state
- this.#currentResultOptions = this.options
-​
- if (this.#currentResultState.data !== undefined) {
- this.#lastQueryWithDefinedData = this.#currentQuery
- }
-​
- // Only notify and update result if something has changed
- if (shallowEqualObjects(nextResult, prevResult)) {
- return
- }