@tanstack/query-core
Advanced tools
Comparing version
@@ -12,7 +12,7 @@ import { av as QueryObserverResult, b as QueryClient, a4 as QueryObserverOptions, a_ as NotifyOptions, u as Query, A as QueryKey, c as QueryObserver } from './hydration-DHZNyHqg.js'; | ||
#private; | ||
constructor(client: QueryClient, queries: Array<QueryObserverOptions<any, any, any, any, any>>, _options?: QueriesObserverOptions<TCombinedResult>); | ||
constructor(client: QueryClient, queries: Array<QueryObserverOptions<any, any, any, any, any>>, options?: QueriesObserverOptions<TCombinedResult>); | ||
protected onSubscribe(): void; | ||
protected onUnsubscribe(): void; | ||
destroy(): void; | ||
setQueries(queries: Array<QueryObserverOptions>, _options?: QueriesObserverOptions<TCombinedResult>, notifyOptions?: NotifyOptions): void; | ||
setQueries(queries: Array<QueryObserverOptions>, options?: QueriesObserverOptions<TCombinedResult>, notifyOptions?: NotifyOptions): void; | ||
getCurrentResult(): Array<QueryObserverResult>; | ||
@@ -19,0 +19,0 @@ getQueries(): Query<unknown, Error, unknown, QueryKey>[]; |
@@ -21,5 +21,5 @@ import { | ||
} | ||
var _client, _result, _queries, _observers, _combinedResult, _lastCombine, _lastResult, _combineResult, combineResult_fn, _findMatchingObservers, findMatchingObservers_fn, _onUpdate, onUpdate_fn, _notify, notify_fn; | ||
var _client, _result, _queries, _options, _observers, _combinedResult, _lastCombine, _lastResult, _combineResult, combineResult_fn, _findMatchingObservers, findMatchingObservers_fn, _onUpdate, onUpdate_fn, _notify, notify_fn; | ||
var QueriesObserver = class extends Subscribable { | ||
constructor(client, queries, _options) { | ||
constructor(client, queries, options) { | ||
super(); | ||
@@ -33,2 +33,3 @@ __privateAdd(this, _combineResult); | ||
__privateAdd(this, _queries, void 0); | ||
__privateAdd(this, _options, void 0); | ||
__privateAdd(this, _observers, void 0); | ||
@@ -39,2 +40,3 @@ __privateAdd(this, _combinedResult, void 0); | ||
__privateSet(this, _client, client); | ||
__privateSet(this, _options, options); | ||
__privateSet(this, _queries, []); | ||
@@ -65,4 +67,5 @@ __privateSet(this, _observers, []); | ||
} | ||
setQueries(queries, _options, notifyOptions) { | ||
setQueries(queries, options, notifyOptions) { | ||
__privateSet(this, _queries, queries); | ||
__privateSet(this, _options, options); | ||
notifyManager.batch(() => { | ||
@@ -135,2 +138,3 @@ const prevObservers = __privateGet(this, _observers); | ||
_queries = new WeakMap(); | ||
_options = new WeakMap(); | ||
_observers = new WeakMap(); | ||
@@ -203,7 +207,14 @@ _combinedResult = new WeakMap(); | ||
notify_fn = function() { | ||
notifyManager.batch(() => { | ||
this.listeners.forEach((listener) => { | ||
listener(__privateGet(this, _result)); | ||
}); | ||
}); | ||
var _a; | ||
if (this.hasListeners()) { | ||
const previousResult = __privateGet(this, _combinedResult); | ||
const newResult = __privateMethod(this, _combineResult, combineResult_fn).call(this, __privateGet(this, _result), (_a = __privateGet(this, _options)) == null ? void 0 : _a.combine); | ||
if (previousResult !== newResult) { | ||
notifyManager.batch(() => { | ||
this.listeners.forEach((listener) => { | ||
listener(__privateGet(this, _result)); | ||
}); | ||
}); | ||
} | ||
} | ||
}; | ||
@@ -210,0 +221,0 @@ export { |
@@ -12,7 +12,7 @@ import { av as QueryObserverResult, b as QueryClient, a4 as QueryObserverOptions, a_ as NotifyOptions, u as Query, A as QueryKey, c as QueryObserver } from './hydration-DHZNyHqg.js'; | ||
#private; | ||
constructor(client: QueryClient, queries: Array<QueryObserverOptions<any, any, any, any, any>>, _options?: QueriesObserverOptions<TCombinedResult>); | ||
constructor(client: QueryClient, queries: Array<QueryObserverOptions<any, any, any, any, any>>, options?: QueriesObserverOptions<TCombinedResult>); | ||
protected onSubscribe(): void; | ||
protected onUnsubscribe(): void; | ||
destroy(): void; | ||
setQueries(queries: Array<QueryObserverOptions>, _options?: QueriesObserverOptions<TCombinedResult>, notifyOptions?: NotifyOptions): void; | ||
setQueries(queries: Array<QueryObserverOptions>, options?: QueriesObserverOptions<TCombinedResult>, notifyOptions?: NotifyOptions): void; | ||
getCurrentResult(): Array<QueryObserverResult>; | ||
@@ -19,0 +19,0 @@ getQueries(): Query<unknown, Error, unknown, QueryKey>[]; |
@@ -18,2 +18,3 @@ // src/queriesObserver.ts | ||
#queries; | ||
#options; | ||
#observers; | ||
@@ -23,5 +24,6 @@ #combinedResult; | ||
#lastResult; | ||
constructor(client, queries, _options) { | ||
constructor(client, queries, options) { | ||
super(); | ||
this.#client = client; | ||
this.#options = options; | ||
this.#queries = []; | ||
@@ -52,4 +54,5 @@ this.#observers = []; | ||
} | ||
setQueries(queries, _options, notifyOptions) { | ||
setQueries(queries, options, notifyOptions) { | ||
this.#queries = queries; | ||
this.#options = options; | ||
notifyManager.batch(() => { | ||
@@ -177,7 +180,16 @@ const prevObservers = this.#observers; | ||
#notify() { | ||
notifyManager.batch(() => { | ||
this.listeners.forEach((listener) => { | ||
listener(this.#result); | ||
}); | ||
}); | ||
if (this.hasListeners()) { | ||
const previousResult = this.#combinedResult; | ||
const newResult = this.#combineResult( | ||
this.#result, | ||
this.#options?.combine | ||
); | ||
if (previousResult !== newResult) { | ||
notifyManager.batch(() => { | ||
this.listeners.forEach((listener) => { | ||
listener(this.#result); | ||
}); | ||
}); | ||
} | ||
} | ||
} | ||
@@ -184,0 +196,0 @@ }; |
{ | ||
"name": "@tanstack/query-core", | ||
"version": "5.59.0", | ||
"version": "5.59.4", | ||
"description": "The framework agnostic core that powers TanStack Query", | ||
@@ -5,0 +5,0 @@ "author": "tannerlinsley", |
@@ -41,2 +41,3 @@ import { notifyManager } from './notifyManager' | ||
#queries: Array<QueryObserverOptions> | ||
#options?: QueriesObserverOptions<TCombinedResult> | ||
#observers: Array<QueryObserver> | ||
@@ -50,3 +51,3 @@ #combinedResult?: TCombinedResult | ||
queries: Array<QueryObserverOptions<any, any, any, any, any>>, | ||
_options?: QueriesObserverOptions<TCombinedResult>, | ||
options?: QueriesObserverOptions<TCombinedResult>, | ||
) { | ||
@@ -56,2 +57,3 @@ super() | ||
this.#client = client | ||
this.#options = options | ||
this.#queries = [] | ||
@@ -89,6 +91,7 @@ this.#observers = [] | ||
queries: Array<QueryObserverOptions>, | ||
_options?: QueriesObserverOptions<TCombinedResult>, | ||
options?: QueriesObserverOptions<TCombinedResult>, | ||
notifyOptions?: NotifyOptions, | ||
): void { | ||
this.#queries = queries | ||
this.#options = options | ||
@@ -275,7 +278,17 @@ notifyManager.batch(() => { | ||
#notify(): void { | ||
notifyManager.batch(() => { | ||
this.listeners.forEach((listener) => { | ||
listener(this.#result) | ||
}) | ||
}) | ||
if (this.hasListeners()) { | ||
const previousResult = this.#combinedResult | ||
const newResult = this.#combineResult( | ||
this.#result, | ||
this.#options?.combine, | ||
) | ||
if (previousResult !== newResult) { | ||
notifyManager.batch(() => { | ||
this.listeners.forEach((listener) => { | ||
listener(this.#result) | ||
}) | ||
}) | ||
} | ||
} | ||
} | ||
@@ -282,0 +295,0 @@ } |
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
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
2109427
0.25%29992
0.29%