* fix(query-core): make sure accessing one property on a query result in useQueries tracks properties across all observers
In useQueries, property tracking is still performed on each individual observer. However, not all invocations will access the property on all observers. For example:
```
results.some((result) => result.isLoading)
```
will only track the `isLoading` property of the first query in the array if `isLoading` is true, because the loop will eagerly abort, and thus the property isn't accessed at all on other observer, which can lead to missing re-renders.
This fix adds a callback to `trackProperties`, which will be invoked when we start to track a property on an observer. Then, in useQueries, we can use this callback to trigger the accessor manually for all other observers.
That makes sure that if a property like `isLoading` is accessed on one observer, it is tracked for all of them.
* refactor: expose trackProp function
* fix(core): do not rely on dataUpdatedAt truthiness
if we want to check for "hasData", we should rather look at state.data and check it against undefined, because it's not possible to have a successful query with data being undefined (since v4)
* chore: fix test that relied on dataUpdatedAt to be set to zero for a query to show up as non-stale
* refactor(*): Import noop function from utils
* Revert "refactor(*): Import noop function from utils"
This reverts commit c76f36fe94.
* refactor(*): Add noop function in each package
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* test(react-query-devtools): add test case for production mode
* chore: update
* chore: update
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
This feature allows the picture-in-picture mode of the devtools to persists through page reloads.
The popup will remain open and will be re-used between page refreshes.
* feat(query-devtools): Adds picture-in-picture mode
This allows the devtools to be detached from the main page and open inside a popup. The components are mounted through a portal onto the new window and all interactions work as expected
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
Methods that access a query by its `queryKey` can bypass `find` to avoid performance issues in large caches.
Co-authored-by: Sebastian Kranz <sebastian.kranz@nubix.de>
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* Update HydrationStreamProvider + advanced SSR docs
* Implement PR feedback
* refactor: no need for refs if we don't have effects
cleanup ts-expect-error by re-using `win`, which is already `any`
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* refactor(types): make queryKey required on ObserverOptions
we cannot create an observer without a key, because an observer, per definition, watches a certain query by its key
* test: observers need a key
* chore: remove a branch that can't exist
we can't have an observer without a queryKey
* fix: when comparing with shallowEqualObjects, the currentResult must come first
because it doesn't detect length changes
* test: we get another event
* types: you can't set queryKey as default
* a test for undefined queryKey makes no sense
* fix: more type issues
* types: queryKey is also not required for defaultOptions in solid
* fix(core): shallowEqualObjects should return false for objects with different lengths
as we use it for options, and the length of options can change