* fix(core): resumed mutations should not be interrupted by refetches
it's important that we don't run a refetch while we're resuming paused mutations, because that could lead to UI flicker. With this fix, we're awaiting until the resume has finished before triggering a refetchOnReconnect or refetchOnWindowFocus
* test: function is async now
* fix: do not notify the cache of `observerOptionsUpdated` if the prevOptions weren't defaulted
non-defaulted prev options indicate a "mount" event, in which case we don't want to fire an "update" event
* fix: react-query tests
with the new assumption that disabled observers are not stale
* fix: solid-query tests
with the new assumption that disabled observers are not stale
* fix: re-add check
accidentally removed to test a failing test
* fix: prefer the stale value of observers if one exists
that check looks for data not undefined anyways, but it also returns "fresh" for disabled observers now
* Update devtools.md
Add note about new dev tools created in react native
* Update devtools.md
* Update docs/framework/react/devtools.md
* chore: prettier
* Update devtools.md
Fixed a typo making the link not accessible
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* fix: make sure all options of a query are reactive
currently, only observer based options are updated between renders (like staleTime), but query level ones are not (like retryDelay). This makes no sense, so trying to streamline here
The deleted test checked for multiple useQuery calls in the tree with different options, which I don't think happens a lot in practice.
As a side-effect, the queryFn is also updated, so it will see values from a closure. This shouldn't matter because everything used in the queryFn must be part of the queryKey
* test: solid adapter
* fix(query-core): allow for unconditional resuming of paused mutations if we get an online event
and try to stabilize flaky test
* test: do not rely on dispatching events in tests
that could influence other tests
* test: don't use getAll
* test(angular-query): add set signal input test utils
* test(angular-query): add some missing test for required input signal to inject query
* feat(angular-query): add required input signal support to inject mutation
* feat(angular-query): add inject mutation test
* feat(angular-query): add lazy signal initializer
* feat(angular-query): add required input signal support for injectMutationState
* feat(angular-query): lazy signal initializer test
* feat(angular-query): lazyInit test and init without reactive context
---------
Co-authored-by: Arnoud <6420061+arnoud-dv@users.noreply.github.com>
* feat: add typesafe react-query disabling via skipToken
* feat: add unique identifier to skip token
* feat(query-core): implement skipToken
* chore(query-core): refactor logic of skipToken
* feat(react-query): do not allow skipToken in useSuspenseQuery
* feat(react-query): handle skip token in suspense react queries, add tests
* refactor(query-core): remove check for queryFn === skipToken, enabled is set to false instead
* refactor(query-core): remove check for queryFn === skipToken, enabled is set to false instead
* chore(react-query): remove unused imports
* fix(react-query): update test to display error message in error boundary
* fix(query-core): reduce bundle size by using Symbol() instead of Symbol.for
* fix(query-core): move check for skipToken into already existing if statement
* refactor(query-core): remove no longer needed check for skipToken
* refactor(query-core): make sure enabled===true takes precendence over skipToken
* refactor(react-query): remove unnecesary check for skipToken
* feat: bring back logging in dev mode
* docs: use `skipToken` in TypeScript examples
* refactor: remove checks that shouldn't be necessary because we now assign `enabled` in `defaultQueryOptions`
* types: adjust useQueries types in non-react adapters
* fix: infiniteQueryBehavior needs to _create_ a function that rejects if we have a skipToken, not reject right away
* refactor: flip condition
* try to fix query options
* fix: make core compilable
* fix: allow skipToken on type level for useSuspenseQuery and warn at runtime
it won't work anyways
* test: dataTag + skipToken
* chore: remove a test that doesn't make much sense
* chore: solid tests
* chore: stabilize test
* rewrite test
* test(react-query): remove not needed doNotExecute from test, test-d.tsx files are not executed anyway
* docs(react-query): add example of skipToken into react-query disabling-queries docs
* docs: update disabling queries examples in Angular, React, and Vue guides
* docs: add description of skipToken to typescript.md
* test(react-query): add unique queryKey to should respect skipToken test
* test(react-query): use helper function instead of string in should respect skipToken test
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
The React Native example previously used `<div> </div>` tags and as we all know, divs are a react thing.
This PR fixes that by using the intended (I believe) `<Text> </Text>` tags
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