0
Fork 0
mirror of https://github.com/TanStack/query.git synced 2026-11-18 19:33:22 +00:00
Commit graph

5,589 commits

Author SHA1 Message Date
Ariel-Moroshko
1980a11f91
docs: 'hydrate' to 'dehydrate' in documentation (#8190) 2024-10-16 14:50:54 +02:00
Tanner Linsley
0c720e1a92 release: v5.59.15 v5.59.15 2024-10-15 17:12:43 +00:00
Gwansik Kim
6c067817d9
fix(react-query): resolve overload matches error with exactOptionalPropertyTypes in queryOptions (#8186) 2024-10-15 19:09:18 +02:00
Tanner Linsley
1adaf3ff86 release: v5.59.14 v5.59.14 2024-10-15 07:20:28 +00:00
Julius Marminge
a085c92a53
fix(react-query): make queryFn optional again (#8176)
* make queryFn optional again

* more fix
2024-10-15 09:16:41 +02:00
Dominik Dorfmeister
d40985401e
fix(react-query): do not overwrite staleTime with the suspense default value if it's a function (#8174)
* fix(react-query): do not overwrite staleTime with the suspense default value if it's a function

* test: improve

* chore: fix test
2024-10-13 11:21:25 +02:00
Tanner Linsley
2649e52df5 release: v5.59.13 v5.59.13 2024-10-12 09:38:41 +00:00
Dominik Dorfmeister
5d69ad773a
fix(query-core): don't finalizeThenable of different queries (#8171)
* 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
2024-10-12 11:36:30 +02:00
Tanner Linsley
8e805fb186 release: v5.59.12 v5.59.12 2024-10-12 07:40:50 +00:00
Dominik Dorfmeister
4758303dd9
fix(query-core): move thenable-recreation into createResult (#8169)
* 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
2024-10-12 09:36:47 +02:00
Ciarán Curley
4dfb0fc0e6
types(react-query): export QueryErrorResetBoundaryFunction (#8089)
* 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>
2024-10-12 09:36:24 +02:00
Tanner Linsley
babf66f2b9 release: v5.59.11 v5.59.11 2024-10-11 18:36:13 +00:00
Gwansik Kim
a991d922e8
refactor(types): throw type error when skipToken is present in suspense query (#8082)
* 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>
2024-10-11 20:30:05 +02:00
Tanner Linsley
c6351949d1 release: v5.59.10 v5.59.10 2024-10-11 18:24:41 +00:00
Dominik Dorfmeister
5edd617eac
fix(core): correctly gc query when suspense is used when query unmounts while it's still fetching (#8168)
* 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
2024-10-11 20:21:58 +02:00
Sunghoon
931d98d5ab
fix(react-query): Allow optional initialData object in queryOptions (#8162)
* fix(react-query): Allow optional initialData in infiniteQueryoptions

* fix(react-query): Allow optional initialData object in queryOptions

* refactor(react-query): removed unnecessary lines in infiniteQueryOptions test

---------

Co-authored-by: chosunghoon <shcho@team-everywhere.com>
2024-10-11 07:27:02 +02:00
Tanner Linsley
6469385c8b release: v5.59.9 v5.59.9 2024-10-10 18:57:09 +00:00
Dominik Dorfmeister
5228e5170c
fix(core): don't consider queries as enabled if they have no observers and have never fetched (successfully or erroneously) (#8161)
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
2024-10-10 20:55:29 +02:00
Gwansik Kim
e3aca98134
test(react-query): update describe in infiniteQueryOptions.test-d.tsx (#8081) 2024-10-10 10:30:06 +02:00
Tanner Linsley
0f7baef16c release: v5.59.8 v5.59.8 2024-10-09 19:10:22 +00:00
Jimmy Callin
329b5f8241
fix: allow optional initialData object (#8157)
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2024-10-09 21:06:53 +02:00
Tanner Linsley
eb341fcdac release: v5.59.7 v5.59.7 2024-10-09 16:21:25 +00:00
Manuel Schiller
81e443caed
fix(eslint-plugin-query): ignore all non-identifier properties in rule infinite-query-property-order (#8158)
fixes #8156
2024-10-09 18:14:17 +02:00
Tanner Linsley
dcffe899fa release: v5.59.6 v5.59.6 2024-10-09 14:34:18 +00:00
David
54995777af
fix(perf): improve long running task performance in query core (#8107)
* 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>
2024-10-09 16:11:57 +02:00
Tanner Linsley
44b70f1200 release: v5.59.5 v5.59.5 2024-10-09 14:00:16 +00:00
Sunghoon
8d03029fa1
fix(react-query): Allow optional initialData in infiniteQueryOptions (#8154)
* fix(react-query): Allow optional initialData in infiniteQueryoptions

* fixup! fix(react-query): Allow optional initialData in infiniteQueryoptions

---------

Co-authored-by: chosunghoon <shcho@team-everywhere.com>
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2024-10-09 15:54:50 +02:00
Tanner Linsley
6c13d01799 release: v5.59.4 v5.59.4 2024-10-09 13:02:22 +00:00
Sol Lee
85a525a309
chore(eslint-plugin-query): expect-expect warning for expectArrayEqualIgnoreOrder (#8143)
* fix: `expect-expect` warning for `expectArrayEqualIgnoreOrder`

* fix: lint error could not find plugin `vitest`
2024-10-09 14:59:14 +02:00
Sol Lee
78b086bd38
chore: no-shadow lint warning in insertAtPositions() (#8142)
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2024-10-09 14:58:36 +02:00
Dominik Dorfmeister
cae25241b9
fix(core): do not inform QueriesObserver subscribers if combined result hasn't changed (#8153) 2024-10-09 14:57:36 +02:00
Dominik Dorfmeister
05ccd65795 test: hydration test case for overwriting with promise 2024-10-09 14:36:25 +02:00
pawel-twardziak
eb2f9d3498
fix(eslint-plugin-query): handle callable params within exaustive-deps rule (#8150)
Closes #8093

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2024-10-09 14:31:00 +02:00
Tanner Linsley
f1f25291db release: v5.59.3 v5.59.3 2024-10-09 05:48:28 +00:00
jxom
e419ab1502
fix(query-core): new cache entry check (#8151)
* fix: queryKeyHashFn

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-09 07:45:01 +02:00
Tanner Linsley
332c5263e4 release: v5.59.2 v5.59.2 2024-10-08 12:32:41 +00:00
Eliya Cohen
c232a6fdec
fix(eslint-plugin-query): handle nullish coalescing operator in exhaustive-deps rule (#8146)
* 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>
2024-10-08 14:30:13 +02:00
Sol Lee
495b0867e1
chore(eslint-plugin-query): change naming for text variables (#8135) 2024-10-07 11:05:25 +02:00
renovate[bot]
2fe16e5588 chore(deps): update dependency svelte to v4.2.19 [security] 2024-10-04 18:02:03 +00:00
renovate[bot]
08a568dbbc chore(deps): update dependency vite to v5.3.6 [security] 2024-10-04 16:48:29 +00:00
Tanner Linsley
8cec02a106 release: v5.59.1 v5.59.1 2024-10-04 12:03:48 +00:00
Sol Lee
bb8278d4c5
fix(eslint-plugin-query): update deprecated getSourceCode() method (#8117)
* fix(eslint-plugin-query): update deprecated `getSourceCode()` method

* chore: add eslint-disable

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2024-10-04 14:01:04 +02:00
Arnoud
05924f4696
docs(angular-query): fix pagination example double devtools (#8125) 2024-10-04 00:04:44 +02:00
Arnoud
a9b3eaf9d0
docs(angular-query): add pagination example (#8124)
* docs(angular-query): add pagination example

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-03 23:50:41 +02:00
Jongchan
69476f0ce5
test(vue-query): add test and improve typing (#8103)
* 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>
2024-10-01 20:26:37 +02:00
Jérémy Barbet
71c5f8801d
docs: sentence wording (#8106) 2024-10-01 20:09:09 +02:00
Sagar Ghimire
b6633831f0
docs: Update mutations.md (#8105) 2024-10-01 20:08:45 +02:00
Tanner Linsley
0ccd60aaba release: v5.59.0 v5.59.0 2024-10-01 15:45:29 +00:00
Alex / KATT
18953be6f6
feat: add support for React.use() (#7988)
* 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>
2024-10-01 17:39:37 +02:00
Gaurav Kumar
55a6155cdf
docs(react-query): Fix broken route on eslint-plugin-query.md (#8113) 2024-10-01 13:10:08 +02:00