@tanstack/react-query 4.28.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.
|
@@ -2841,9 +2841,10 @@
|
|
|
2841
2841
|
|
|
2842
2842
|
findMatchingObservers(queries) {
|
|
2843
2843
|
const prevObservers = this.observers;
|
|
2844
|
+
const prevObserversMap = new Map(prevObservers.map(observer => [observer.options.queryHash, observer]));
|
|
2844
2845
|
const defaultedQueryOptions = queries.map(options => this.client.defaultQueryOptions(options));
|
|
2845
2846
|
const matchingObservers = defaultedQueryOptions.flatMap(defaultedOptions => {
|
|
2846
|
-
const match =
|
|
2847
|
+
const match = prevObserversMap.get(defaultedOptions.queryHash);
|
|
2847
2848
|
|
|
2848
2849
|
if (match != null) {
|
|
2849
2850
|
return [{
|
|
@@ -2854,9 +2855,10 @@
|
|
|
2854
2855
|
|
|
2855
2856
|
return [];
|
|
2856
2857
|
});
|
|
2857
|
-
const matchedQueryHashes = matchingObservers.map(match => match.defaultedQueryOptions.queryHash);
|
|
2858
|
-
const unmatchedQueries = defaultedQueryOptions.filter(defaultedOptions => !matchedQueryHashes.
|
|
2859
|
-
const
|
|
2858
|
+
const matchedQueryHashes = new Set(matchingObservers.map(match => match.defaultedQueryOptions.queryHash));
|
|
2859
|
+
const unmatchedQueries = defaultedQueryOptions.filter(defaultedOptions => !matchedQueryHashes.has(defaultedOptions.queryHash));
|
|
2860
|
+
const matchingObserversSet = new Set(matchingObservers.map(match => match.observer));
|
|
2861
|
+
const unmatchedObservers = prevObservers.filter(prevObserver => !matchingObserversSet.has(prevObserver));
|
|
2860
2862
|
|
|
2861
2863
|
const getObserver = options => {
|
|
2862
2864
|
const defaultedOptions = this.client.defaultQueryOptions(options);
|