Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(queriesObserver): do not bail-out of calling setResult for empty …
…queries (#6614) * fix(core): make sure to call setResult before the early bail-out The initial fix for #6369 (#6431) introduced a regression where we'd always call combine with an empty array initially. Turns out it was actually on purpose that we didn't call combine in the constructor, but delayed that until the `setQueries` call - because there, we already have complete query result structures available However, there is an optimization that bails out early without calling this.#setResult if "nothing changed"; however, if we call useQueries with an empty array, that means nothing every changes, and the #combinedResult is actually never set, leading to structural sharing never having anything to share with, thus yielding a new reference every time (this is the root issue for #6369). This fix reverts those changes (to avoid calling combine with an empty array every time, thus fixing #6612) and makes sure #setResult is always invoked before bailing out, so that #combinedResult is set correctly even for this case * fix: add a special length check to the bail-out case we only want to stop bailing out if we have no queries; moving the #setResult call unconditionally before the bail-out leads to more re-renders for other useQueries calls now, we only stop the bail-out when the special empty case sets in, which is what fixes #6612
- Loading branch information