Commit 13e69b0
nrahnema
fix(query-core): fix queriesObserver result and observer length mismatch
In 1b54538, `setOptions` was changed to call `notifyListeners` which
eventually leads to `QueriesObserver.setQueries`
1. Updating `#observerMatches`
2. Calling `setOptions` which leads to `#notify` being called
3. Updating `#result`
This is an issue when `#notify` is called before the `#result` is
updated, as `#trackResult` assumes these two are the same length, which
may not be the case if the number of queries changed. When the length
increases, `observerResult` becomes `undefined` and the function throws
an exception.
Fix by moving the `#observerMatches` assignment later in the function,
next to the `#observers` and `#result` assignment.1 parent f15b7fc commit 13e69b0
File tree
2 files changed
+6
-1
lines changed- .changeset
- packages/query-core/src
2 files changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
| |||
134 | 133 | | |
135 | 134 | | |
136 | 135 | | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
0 commit comments