* fix(query-core): don't finalizeThenable of different queries
if we have multiple promises in-flight, once they resolve, we need to make sure to not finalize with data / error from a different key; otherwise, we might see intermediate data of non-matching keys
* chore: extract promise tests to their own file
* test: add a test case for not resolving with intermediate data
* fix: only stop finalizing if we were previously in pending state
this makes sure we can read stale data from entries when switching to them immediately
* chore: add another test for background updates
* fix: move thenable-recreation into createResult
`updateResult` will only be called after a fetch, but when we switch between caches without a fetch, we will only call `createResult`; this fix stops `data` from the queryResult and the `thenable` to go out-of-sync; it's backwards compatible because `updateResult` also invokes `createResult`
* oops
* test: I'm sick of this flaky test
* chore: eslint reports an unused type assertion here
* feat(react-query): export QueryErrorResetBoundaryFunction
Export the QueryErrorResetBoundaryFunction render prop function
signature so users don't have to write wierd types of there own
* fix: add extra functions
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* refactor: handle type error when skipToken is present in suspense query
* test(react-query): add skipToken test for query hooks
* fix: merge form main
* ci: apply automated fixes
* feat(react-query): display “skipToken is not allowed” message in suspense hooks
* feat(react-query): display “skipToken is not allowed” message in suspense hooks
* feat(react-query): display “skipToken is not allowed” message in suspense hooks
* fix(react-query): update error message in useSuspenseInfiniteQuery
* test(react-query): add test case
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* fix(core): correctly gc query when suspense is used when query unmounts while it's still fetching
the `isFetchingOptimistic` workaround was added to make sure some "thing" I don't remember anymore works in suspense; we added tests for that;
however, in the meantime, we added a minimum gcTime for suspense queries, which also solves that problem (tests still work); this makes the `isFetchingOptimistic` workaround unnecessary, and this workaround is actually what causes the unmount issue
* chore: try to stabilize a flaky test
it's very likely that this used to be a disabled observer; one other case would be canceling a query while you were initially fetching it, but this is a weird corner case that brings all sorts of troubles
additionally, we can check for the queryFn being a skipToken; even if we have data in the cache, when the queryFn is currently set to skipToken, this is means we never want to see this query fetch
* fix: improve long running task performance in query core
This addresses two hot spots we have noticed
on a large scale enterprise app when profiling
with chrome. These changes help to cut down
on long running tasks when there are many query
calls on the page
* refactor: remove two more arrays to be more efficient
* refactor: remove queryObserver improvement from PR
* refactor: packages/query-core/src/queryObserver.ts remove
---------
Co-authored-by: davidaghassi <davidaghassi@robinhood.com>
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* fix: handle nullish coalescing operator in exhaustive-deps rule
Ensure that the exhaustive-deps rule correctly handles cases where the nullish coalescing operator (??) is used in query functions.
Example test case:
* ci: apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* test(vue-query): add test for clone getters returning values in queryKey
* fix(vue-query): improve typing in vueQueryPlugin.test.ts to resolve errors on tsc
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* let’s do it again
* fix test group
* maybe
* mkay
* cool
* rm console.logs
* mkay
* mkay
* fix(vue-query): invalidate queries immediately after calling `invalidateQueries` (#7930)
* fix(vue-query): invalidate queries immediately after call `invalidateQueries`
* chore: recovery code comments
* release: v5.53.2
* docs(vue-query): update SSR guide for nuxt2 (#8001)
* docs: update SSR guide for nuxt2
* ci: apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* thenable
* mkay
* Update packages/react-query/src/__tests__/useQuery.test.tsx
* mkay
* mkay
* faster and more consistent
* mkay
* mkay
* mkay
* mkay
* mkay
* fix unhandled rejections
* more
* more
* mkay
* fix more
* fixy
* cool
* Update packages/react-query/package.json
* fix: track data property if `promise` is tracked
if users use the `promise` returned from useQuery, they are actually interested in the `data` it unwraps to. Since the promise doesn't change when data resolves, we would likely miss a re-render
* Revert "fix: track data property if `promise` is tracked"
This reverts commit d1184babd1.
* add test case that @tkdodo was concerned about
* tweak
* mkay
* add `useInfiniteQuery()` test
* consistent testing
* better test
* rm comment
* test resetting errror boundary
* better test
* cool
* cool
* more test
* mv cleanup
* mkay
* some more things
* add fixme
* fix types
* wat
* fixes
* revert
* fix
* colocating doesn’t workkk
* mkay
* mkay
* might work
* more test
* cool
* i don’t know hwat i’m doing
* mocky
* lint
* space
* rm log
* setIsServer
* mkay
* ffs
* remove unnecessary stufffff
* tweak more
* just naming and comments
* tweak
* fix: use fetchOptimistic util instead of observer.fetchOptimistic
* refactor: make sure to only trigger fetching during render if we really have no cache entry yet
* fix: move the `isNewCacheEntry` check before observer creation
* chore: avoid rect key warnings
* fix: add an `updateResult` for all observers to finalize currentThenable
* chore: logs during suspense errors
* fix: empty catch
* feature flag
* add comment
* simplify
* omit from suspense
* feat flag
* more tests
* test: scope experimental_promise to useQuery().promise tests
* refactor: rename to experimental_prefetchInRender
* test: more tests
* test: more cancelation
* fix cancellation
* make it work
* tweak comment
* Update packages/react-query/src/useBaseQuery.ts
* simplify code a bit
* Update packages/query-core/src/queryObserver.ts
* refactor: move experimental_prefetchInRender check until after the early bail-out
* fix: when cancelled, the promise should stay pending
* test: disabled case
* chore: no idea what's going on
* refactor: delete unnecessary check
* revert refactor i did for cancellation when we wanted it to `throw`
* add docs
* align
* tweak
* Update docs/reference/QueryClient.md
* Update docs/framework/react/reference/queryOptions.md
---------
Co-authored-by: Alex Liu <dsa1314@gmail.com>
Co-authored-by: Tanner Linsley <tannerlinsley@users.noreply.github.com>
Co-authored-by: Damian Osipiuk <osipiukd+git@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>