@tanstack/vue-query 4.27.0 → 4.29.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.
|
@@ -2817,9 +2817,10 @@
|
|
|
2817
2817
|
|
|
2818
2818
|
findMatchingObservers(queries) {
|
|
2819
2819
|
const prevObservers = this.observers;
|
|
2820
|
+
const prevObserversMap = new Map(prevObservers.map(observer => [observer.options.queryHash, observer]));
|
|
2820
2821
|
const defaultedQueryOptions = queries.map(options => this.client.defaultQueryOptions(options));
|
|
2821
2822
|
const matchingObservers = defaultedQueryOptions.flatMap(defaultedOptions => {
|
|
2822
|
-
const match =
|
|
2823
|
+
const match = prevObserversMap.get(defaultedOptions.queryHash);
|
|
2823
2824
|
|
|
2824
2825
|
if (match != null) {
|
|
2825
2826
|
return [{
|
|
@@ -2830,9 +2831,10 @@
|
|
|
2830
2831
|
|
|
2831
2832
|
return [];
|
|
2832
2833
|
});
|
|
2833
|
-
const matchedQueryHashes = matchingObservers.map(match => match.defaultedQueryOptions.queryHash);
|
|
2834
|
-
const unmatchedQueries = defaultedQueryOptions.filter(defaultedOptions => !matchedQueryHashes.
|
|
2835
|
-
const
|
|
2834
|
+
const matchedQueryHashes = new Set(matchingObservers.map(match => match.defaultedQueryOptions.queryHash));
|
|
2835
|
+
const unmatchedQueries = defaultedQueryOptions.filter(defaultedOptions => !matchedQueryHashes.has(defaultedOptions.queryHash));
|
|
2836
|
+
const matchingObserversSet = new Set(matchingObservers.map(match => match.observer));
|
|
2837
|
+
const unmatchedObservers = prevObservers.filter(prevObserver => !matchingObserversSet.has(prevObserver));
|
|
2836
2838
|
|
|
2837
2839
|
const getObserver = options => {
|
|
2838
2840
|
const defaultedOptions = this.client.defaultQueryOptions(options);
|