@tanstack/query-core
Advanced tools
Comparing version 5.66.2 to 5.66.3
@@ -21,3 +21,3 @@ import { | ||
} | ||
var _client, _result, _queries, _options, _observers, _combinedResult, _lastCombine, _lastResult, _trackResult, trackResult_fn, _combineResult, combineResult_fn, _findMatchingObservers, findMatchingObservers_fn, _onUpdate, onUpdate_fn, _notify, notify_fn; | ||
var _client, _result, _queries, _options, _observers, _combinedResult, _lastCombine, _lastResult, _observerMatches, _trackResult, trackResult_fn, _combineResult, combineResult_fn, _findMatchingObservers, findMatchingObservers_fn, _onUpdate, onUpdate_fn, _notify, notify_fn; | ||
var QueriesObserver = class extends Subscribable { | ||
@@ -39,2 +39,3 @@ constructor(client, queries, options) { | ||
__privateAdd(this, _lastResult, void 0); | ||
__privateAdd(this, _observerMatches, []); | ||
__privateSet(this, _client, client); | ||
@@ -83,2 +84,3 @@ __privateSet(this, _options, options); | ||
const newObserverMatches = __privateMethod(this, _findMatchingObservers, findMatchingObservers_fn).call(this, __privateGet(this, _queries)); | ||
__privateSet(this, _observerMatches, newObserverMatches); | ||
newObserverMatches.forEach( | ||
@@ -133,3 +135,3 @@ (match) => match.observer.setOptions(match.defaultedQueryOptions, notifyOptions) | ||
() => { | ||
return __privateMethod(this, _trackResult, trackResult_fn).call(this, result, queries); | ||
return __privateMethod(this, _trackResult, trackResult_fn).call(this, result, matches); | ||
} | ||
@@ -147,5 +149,5 @@ ]; | ||
_lastResult = new WeakMap(); | ||
_observerMatches = new WeakMap(); | ||
_trackResult = new WeakSet(); | ||
trackResult_fn = function(result, queries) { | ||
const matches = __privateMethod(this, _findMatchingObservers, findMatchingObservers_fn).call(this, queries); | ||
trackResult_fn = function(result, matches) { | ||
return matches.map((match, index) => { | ||
@@ -211,3 +213,4 @@ const observerResult = result[index]; | ||
const previousResult = __privateGet(this, _combinedResult); | ||
const newResult = __privateMethod(this, _combineResult, combineResult_fn).call(this, __privateMethod(this, _trackResult, trackResult_fn).call(this, __privateGet(this, _result), __privateGet(this, _queries)), (_a = __privateGet(this, _options)) == null ? void 0 : _a.combine); | ||
const newTracked = __privateMethod(this, _trackResult, trackResult_fn).call(this, __privateGet(this, _result), __privateGet(this, _observerMatches)); | ||
const newResult = __privateMethod(this, _combineResult, combineResult_fn).call(this, newTracked, (_a = __privateGet(this, _options)) == null ? void 0 : _a.combine); | ||
if (previousResult !== newResult) { | ||
@@ -214,0 +217,0 @@ notifyManager.batch(() => { |
@@ -23,2 +23,3 @@ // src/queriesObserver.ts | ||
#lastResult; | ||
#observerMatches = []; | ||
constructor(client, queries, options) { | ||
@@ -69,2 +70,3 @@ super(); | ||
const newObserverMatches = this.#findMatchingObservers(this.#queries); | ||
this.#observerMatches = newObserverMatches; | ||
newObserverMatches.forEach( | ||
@@ -119,8 +121,7 @@ (match) => match.observer.setOptions(match.defaultedQueryOptions, notifyOptions) | ||
() => { | ||
return this.#trackResult(result, queries); | ||
return this.#trackResult(result, matches); | ||
} | ||
]; | ||
} | ||
#trackResult(result, queries) { | ||
const matches = this.#findMatchingObservers(queries); | ||
#trackResult(result, matches) { | ||
return matches.map((match, index) => { | ||
@@ -181,6 +182,4 @@ const observerResult = result[index]; | ||
const previousResult = this.#combinedResult; | ||
const newResult = this.#combineResult( | ||
this.#trackResult(this.#result, this.#queries), | ||
this.#options?.combine | ||
); | ||
const newTracked = this.#trackResult(this.#result, this.#observerMatches); | ||
const newResult = this.#combineResult(newTracked, this.#options?.combine); | ||
if (previousResult !== newResult) { | ||
@@ -187,0 +186,0 @@ notifyManager.batch(() => { |
{ | ||
"name": "@tanstack/query-core", | ||
"version": "5.66.2", | ||
"version": "5.66.3", | ||
"description": "The framework agnostic core that powers TanStack Query", | ||
@@ -5,0 +5,0 @@ "author": "tannerlinsley", |
@@ -46,2 +46,3 @@ import { notifyManager } from './notifyManager' | ||
#lastResult?: Array<QueryObserverResult> | ||
#observerMatches: Array<QueryObserverMatch> = [] | ||
@@ -110,2 +111,3 @@ constructor( | ||
const newObserverMatches = this.#findMatchingObservers(this.#queries) | ||
this.#observerMatches = newObserverMatches | ||
@@ -182,3 +184,3 @@ // set options for the new observers to notify of changes | ||
() => { | ||
return this.#trackResult(result, queries) | ||
return this.#trackResult(result, matches) | ||
}, | ||
@@ -190,6 +192,4 @@ ] | ||
result: Array<QueryObserverResult>, | ||
queries: Array<QueryObserverOptions>, | ||
matches: Array<QueryObserverMatch>, | ||
) { | ||
const matches = this.#findMatchingObservers(queries) | ||
return matches.map((match, index) => { | ||
@@ -270,6 +270,4 @@ const observerResult = result[index]! | ||
const previousResult = this.#combinedResult | ||
const newResult = this.#combineResult( | ||
this.#trackResult(this.#result, this.#queries), | ||
this.#options?.combine, | ||
) | ||
const newTracked = this.#trackResult(this.#result, this.#observerMatches) | ||
const newResult = this.#combineResult(newTracked, this.#options?.combine) | ||
@@ -276,0 +274,0 @@ if (previousResult !== newResult) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1964250
22595