@@ -77,45 +77,46 @@ export class QueriesObserver extends Subscribable<QueriesObserverListener> {
77
77
const newObservers : QueryObserver [ ] = [ ]
78
78
const newObserversMap : Record < string , QueryObserver > = { }
79
79
80
- const defaultedQueryOptions = queries . map ( o =>
81
- this . client . defaultQueryObserverOptions ( o )
80
+ const defaultedQueryOptions = queries . map ( options =>
81
+ this . client . defaultQueryObserverOptions ( options )
82
82
)
83
83
const matchingObservers = defaultedQueryOptions
84
- . map ( o => {
85
- if ( o . queryHash == null ) {
84
+ . map ( options => {
85
+ if ( options . queryHash == null ) {
86
86
return null
87
87
}
88
- const match = prevObserversMap [ o . queryHash ]
88
+ const match = prevObserversMap [ options . queryHash ]
89
89
if ( match != null ) {
90
- match . setOptions ( o , notifyOptions )
90
+ match . setOptions ( options , notifyOptions )
91
91
return match
92
92
}
93
93
return null
94
94
} )
95
95
. filter ( notNullOrUndefined )
96
96
97
97
const matchedQueryHashes = matchingObservers
98
- . map ( o => o ?. options . queryHash )
98
+ . map ( observer => observer ?. options . queryHash )
99
99
. filter ( notNullOrUndefined )
100
100
const unmatchedQueries = defaultedQueryOptions . filter (
101
- o =>
102
- o . queryHash !== undefined && ! matchedQueryHashes . includes ( o . queryHash )
101
+ options =>
102
+ options . queryHash !== undefined &&
103
+ ! matchedQueryHashes . includes ( options . queryHash )
103
104
)
104
105
105
106
const unmatchedObservers = prevObservers . filter (
106
- p => ! matchingObservers . includes ( p )
107
+ prevObserver => ! matchingObservers . includes ( prevObserver )
107
108
)
108
109
109
- const newlyMatchedOrCreatedObservers = unmatchedQueries . map ( q => {
110
- if ( q . keepPreviousData && unmatchedObservers . length > 0 ) {
111
- // use the first existing but no longer matched query to keep query data for any new queries
110
+ const newlyMatchedOrCreatedObservers = unmatchedQueries . map ( options => {
111
+ if ( options . keepPreviousData && unmatchedObservers . length > 0 ) {
112
+ // use the first observer but no longer matched query to keep query data for any new queries
112
113
const firstObserver = unmatchedObservers . splice ( 0 , 1 ) [ 0 ]
113
114
if ( firstObserver !== undefined ) {
114
- firstObserver . setOptions ( q , notifyOptions )
115
+ firstObserver . setOptions ( options , notifyOptions )
115
116
return firstObserver
116
117
}
117
118
}
118
- return this . getObserver ( q )
119
+ return this . getObserver ( options )
119
120
} )
120
121
121
122
matchingObservers
@@ -148,7 +149,7 @@ export class QueriesObserver extends Subscribable<QueriesObserverListener> {
148
149
)
149
150
150
151
const hasIndexChange = updatedObservers . newObservers . some (
151
- ( o , i ) => o !== prevObservers [ i ]
152
+ ( observer , index ) => observer !== prevObservers [ index ]
152
153
)
153
154
if (
154
155
prevObservers . length === updatedObservers . newObservers . length &&
0 commit comments