when mutations are resumed after they have been restored from an external storage, there is no retryer that can pick up the mutation where it left off, so we need to re-execute it from scratch. However, this doesn't really happen if we are offline - the promise will be pending until we go online again; only "continue" from the retryer can immediately resolve a Promise here - execute needs to wait until it's really finished. But since mutations run in serial when resumed, this will lead to a forever hanging promise.
With this fix, `queryClient.resumePausedMutations` will only resume them if we are currently online to avoid this state.
* 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>