0
Fork 0
mirror of https://github.com/TanStack/query.git synced 2026-11-16 22:50:20 +00:00
Commit graph

5,550 commits

Author SHA1 Message Date
HuijungYoon
d576092e2e
fix(query-core): prevent reducer from being called twice in streamedQuery (#9970)
* fix(query-core): prevent reducer from being called twice in streamedQuery #9787

- Fix bug where reducer was called twice for each chunk (once in setQueryData, once in loop)
- Store reducer result in variable to avoid duplicate calls
- Add test case to verify reducer is only called once per chunk

* fix(streamed-query): prevent reducer from being called twice

Fixed an issue where the reducer was being invoked twice when refetchMode is set to 'replace'.
Added a regression test to verify the fix.

Fixes #9787

* docs: add changeset and lockfile update

* fix(changeset): change version bump to patch

* Update streamedQuery.test.tsx

fix: lint

* fix: support refetchMode append and prevent double reducer calls

- Fix refetchMode append to preserve existing data on refetch
- Fix reducer being called twice by calling it once and storing result
- Update pnpm-lock.yaml to match main branch

* chore: update pnpm-lock.yaml to include size-limit dependencies

* ci: apply automated fixes

* refactor: simplify streamedQuery logic with clearer isReplaceRefetch condition

- Extract isReplaceRefetch variable for better readability
- Use explicit if-else instead of negated conditions
- Make it clearer when reducer is called in each branch

---------

Co-authored-by: TkDodo <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-12-28 15:30:40 +01:00
Matthew Costabile
f9fc56a9b8
fix(devtools): Handle some additional query devtools accessibility findings (#9961)
* improve a11y again

* ci: apply automated fixes

* changeset

* more granular read

* add valuemin

* a few more nits

* fix mouseUp

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-12-28 15:21:24 +01:00
Ji-hoon Choi
0b29b6f877
fix(devtools): handle PiP open failures by resetting persisted state (#9983)
fix: handle PiP open failures by resetting persisted state

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-12-28 15:02:10 +01:00
Wonsuk Choi
642f72d699
test(react-query/ssr): add 'useIsFetching' test for SSR (#9994) 2025-12-28 14:14:04 +01:00
dilmuhammad abdumalikov
31e3db527a
Enhance scroll restoration documentation for TanStack Query (#9987)
* Enhance scroll restoration documentation for TanStack Query

Explain how TanStack Query improves scroll restoration in SPAs by caching data and preventing UI resets.

* Update docs/framework/react/guides/scroll-restoration.md

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-12-28 11:29:15 +01:00
Dominik Dorfmeister
e722679e16
ref: move size-limit config to its own file (#9998)
* ref: move size-limit config to its own file

to avoid cache busting everything when the limits change

* ref: update size-limit
2025-12-28 10:25:52 +01:00
github-actions[bot]
1d20c486ae
ci: Version Packages (#9997) @tanstack/react-query-persist-client@5.90.15
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-28 10:10:24 +01:00
razhayat
4a0a78afbc
fix: streamed query consume aware signal (#9963)
* chore: move consume aware signal logic to utils

* fix: add consume aware signal to streamedQuery

* test: add a test for not a signal that is not consumed by streamFn

* chore: add changeset

* fix: made queryFn of streamedQuery not consume signal directly (so that only streamFn can consume it)

* fix: made onCancelled get called only once

* fix: memoized getSignal and made sure it is called only once

* fix: no-unnecessary-condition

* chore: size-limit

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-12-28 10:06:55 +01:00
TkDodo
5810292b38 fix: size-limit 2025-12-27 18:05:51 +01:00
TkDodo
51b895c718 fix: size-limit 2025-12-27 18:02:48 +01:00
TkDodo
dd45407927 fix: run size-limit with --json 2025-12-27 17:56:48 +01:00
Dominik Dorfmeister
afc64091cd
feat: size-limit (#9993)
* feat: size-limit

* fix: script

* fix: add test:size to nx

* fix: skip install and build

* really

* fix: size-limit options

* ok we need build step

* fix: test-size runs as part of its own action
2025-12-27 17:33:07 +01:00
Tanner Linsley
f64ac77e83
Update bundlephobia link to TanStack React Query (#9990)
docs: update bundlephobia links to @tanstack/react-query

The bundlephobia links were pointing to the old react-query package (v3)
instead of the current @tanstack/react-query package.

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-27 13:01:45 +01:00
Talgat Minigaliev
bdec357b9e
docs: Modify onMutate signature to add context parameter (#9982)
Updated the onMutate function signature to include context.
2025-12-27 12:31:21 +01:00
Wonsuk Choi
7a3990eba7
test(solid-query/useQuery): migrate to fake timers, replace 'waitFor' with 'advanceTimersByTimeAsync', and improve 'queryFn' patterns (#9894)
* test(solid-query/useQuery): migrate to fake timers with 'advanceTimersByTimeAsync', add 'expect().toBeInTheDocument()', convert sync 'queryFn' to 'sleep().then()', and add detailed timing comments

* test(solid-query/useQuery): replace 'async/await' with 'sleep().then()' pattern in queryFn

* refactor(solid-query/useQuery.test): convert complex 'then' callbacks to async/await pattern
2025-12-27 12:27:20 +01:00
Wonsuk Choi
2be25ca08d
test(react-query/HydrationBoundary): add tests for 'enabled: false' and 'staleTime: Infinity' (#9969)
* test(react-query/HydrationBoundary): add tests for 'enabled: false' and 'staleTime: Infinity'

* chore: trigger CI

* test(react-query/HydrationBoundary): add delayed assertions for 'enabled: false' and 'staleTime: Infinity' tests
2025-12-27 12:26:53 +01:00
Wonsuk Choi
e63673b7fb
test(svelte-query-persist-client/PersistQueryClientProvider): switch to fake timers, replace 'waitFor' with 'advanceTimersByTimeAsync', and use 'sleep().then()' pattern (#9900)
* test(svelte-query-persist-client/PersistQueryClientProvider): switch to fake timers, replace 'waitFor' with 'advanceTimersByTimeAsync', and use 'sleep().then()' pattern

* test(svelte-query-persist-client/PersistQueryClientProvider): replace 'setQueryDefaults' with 'onFetch' callback in FreshData

* refactor(svelte-query-persist-client/FreshData): convert complex 'then' callback to async/await pattern
2025-12-27 12:26:24 +01:00
Wonsuk Choi
968fb43ad8
test(angular-query-persist-client/withPersistQueryClient): switch to fake timers, replace 'waitFor' with 'advanceTimersByTimeAsync', use 'sleep().then()' pattern, replace 'screen' with 'rendered', add 'toBeInTheDocument', and add '@testing-library/jest-dom/vitest' (#9895)
* test(angular-query-persist-client/withPersistQueryClient): switch to fake timers, replace 'waitFor' with 'advanceTimersByTimeAsync', use 'sleep().then()' pattern, replace 'screen' with 'rendered', add 'toBeInTheDocument', and add '@testing-library/jest-dom/vitest'

* test(angular-query-persist-client/withPersistQueryClient): replace 'async/await' with 'sleep().then()' pattern in queryFn and restoreClient

* refactor(angular-query-persist-client/withPersistQueryClient.test): convert complex 'then' callbacks to async/await pattern
2025-12-27 12:24:42 +01:00
Wonsuk Choi
573bf58eaf
test(solid-query-persist-client/PersistQueryClientProvider): switch to fake timers, replace 'waitFor' with 'advanceTimersByTimeAsync', and use 'sleep().then()' pattern (#9892)
* test(solid-query-persist-client/PersistQueryClientProvider): switch to fake timers, replace 'waitFor' with 'advanceTimersByTimeAsync', and use 'sleep().then()' pattern

* refactor(solid-query-persist-client/PersistQueryClientProvider.test): convert complex 'then' callback to async/await pattern
2025-12-27 12:23:36 +01:00
Wonsuk Choi
6161dcd121
test(react-query-persist-client/PersistQueryClientProvider): convert complex 'then' callback to async/await and add delayed assertion for refetch verification (#9901)
* test(react-query-persist-client/PersistQueryClientProvider): replace 'await sleep' with 'sleep().then()' pattern in restoreClient and add additional timer advance for refetch verification

* refactor(react-query-persist-client/PersistQueryClientProvider.test): convert complex 'then' callbacks to async/await pattern
2025-12-27 12:22:58 +01:00
Ofek Lavie
8471715987
docs: Document possible conflict between PersistQueryClientProvider and SSR streaming (#9979)
* Add docs about PersistQueryClientProvider settings

* correct

* Apply suggestion from @TkDodo

* Apply suggestions from code review

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-12-26 20:36:05 +01:00
Bailey Lissington
ecf9696c08
docs: correct grammar (#9953) 2025-12-26 20:33:39 +01:00
Elias Witt
23f636c674
docs: fix small grammar mistake (#9992) 2025-12-26 20:33:14 +01:00
Shumyla Farid
ee16773c70
docs: clarify cache time in caching guide for useQuery (#9967)
Clarify cache time in caching guide for useQuery
2025-12-21 15:01:52 +01:00
BrysonXiao
84d98445c4
docs: Update prefetching.md to fix typo (#9984)
A "be" was missing in the paragraph.
2025-12-21 14:35:13 +01:00
Lachlan Collins
f15b7fcc01
ci: prepare for trusted publishing (#9952)
* ci: prepare for trusted publishing

* Format

* Remove NPM_TOKEN
2025-12-07 01:47:55 +11:00
Lachlan Collins
5ad78fc4ad
docs: correct local relative links (#9947)
* docs: correct local relative links

* Update links

* Slight tweaks

* String
2025-12-05 22:39:25 +11:00
github-actions[bot]
9e8709eddb
ci: Version Packages (#9945) @tanstack/angular-query-experimental@5.90.16 @tanstack/query-async-storage-persister@5.90.14 @tanstack/query-broadcast-client-experimental@5.90.12 @tanstack/query-core@5.90.12 @tanstack/query-persist-client-core@5.91.11 @tanstack/query-sync-storage-persister@5.90.14 @tanstack/react-query-persist-client@5.90.14 @tanstack/react-query@5.90.12 @tanstack/solid-query-persist-client@5.90.15 @tanstack/solid-query@5.90.15 @tanstack/svelte-query-persist-client@6.0.12 @tanstack/svelte-query@6.0.10 @tanstack/vue-query@5.92.1
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-04 12:12:48 +01:00
Dominik Dorfmeister
72d8ac5c59
fix: update react and nextJs (#9944)
* fix: update react and nextJs

and add a nextJs16 integration test

* ci: apply automated fixes

* oops

* Update patch versions for React and TanStack packages

Updated the patch versions for various React and TanStack packages.

* fix: streamline dependencies

* bundle size

* fix lock file

* fix: update react in example

* skip test for now

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-12-04 10:10:29 +01:00
Lachlan Collins
7e99b885ff
docs: fix sidebar links (#9933) 2025-11-30 08:08:25 +11:00
Lachlan Collins
7f4939c624
ci: sync config between projects (#9931)
* ci: update typedoc

* Remove old check
2025-11-29 19:55:40 +11:00
Lachlan Collins
b7b452e407
ci: remove @tanstack/publish-config (#9930)
* ci: remove @tanstack/publish-config

* Update imports
2025-11-29 16:22:35 +11:00
Lachlan Collins
73eb629169
ci(changesets): enable experimental peerDependents option (#9928)
* ci(changesets): enable experimental peerDependents option

* Fix typescript-eslint versions
2025-11-28 09:03:49 +11:00
Lachlan Collins
aba3260e4d
ci(changesets): disable auto-merging (#9918)
* ci(changesets): disable auto-merging

* Fix knip
2025-11-27 11:10:12 +11:00
Damian Osipiuk
1f0ec12229
chore: bring back proper devtools version (#9917) @tanstack/vue-query-devtools@6.1.2 @tanstack/vue-query@5.92.0
* chore: bring back proper devtools version

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-26 17:29:58 +01:00
github-actions[bot]
c7510cc6d6
ci: Version Packages (#9916)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-26 16:19:34 +00:00
Damian Osipiuk
758414fcec
feat(vue-query): allow options getters in additional composables (#9914) 2025-11-26 17:18:09 +01:00
Stanyslas Bres
8b387341eb
docs(vue): change query keys example to typescript (#9907)
* docs(vue): change query keys example to typescript

This example is written in Javascript, and the fact that `todoId` is a `Ref` is a bit hard to identify.

I propose to migrate this example to Typescript, with an import to Vue's Ref type and make the parameter to the example composable explicit.

There are more docs that could be improved this way, if it suits you I could also make the changes to these docs :)

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-26 13:28:17 +01:00
github-actions[bot]
6799395211
ci: Version Packages (#9911) @tanstack/angular-query-experimental@5.90.15 @tanstack/query-async-storage-persister@5.90.13 @tanstack/query-broadcast-client-experimental@5.90.11 @tanstack/query-core@5.90.11 @tanstack/query-persist-client-core@5.91.10 @tanstack/query-sync-storage-persister@5.90.13 @tanstack/react-query-persist-client@5.90.13 @tanstack/react-query@5.90.11 @tanstack/solid-query-persist-client@5.90.14 @tanstack/solid-query@5.90.14 @tanstack/svelte-query-persist-client@6.0.11 @tanstack/svelte-query@6.0.9 @tanstack/vue-query@5.91.4
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-25 16:41:41 +00:00
Olivier Beaulieu
c01b150e36
fix(useQueries): Prevent infinite render loops when useSuspenseQueries has duplicate queryKeys (#9886)
* Prevent infinite render loops when useSuspenseQueries has duplicate queryKeys

* changeset

* tweaks

* smaller diff

* lint

* lint

* remove newline

* remove non-null assertion

* ci: apply automated fixes

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-25 17:35:22 +01:00
github-actions[bot]
46ebef2e67
ci: Version Packages (#9909) @tanstack/vue-query@5.91.3
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-25 12:21:46 +00:00
zhong666
3ce7910b3f
fix(vue-query): include TPageParam in enabled of InfiniteQueryObserverOptions (#9898)
* fix(vue): include TPageParam in enabled of InfiniteQueryObserverOptions

* chore: add changeset
2025-11-25 13:18:29 +01:00
github-actions[bot]
025358880f
ci: Version Packages (#9908) @tanstack/angular-query-experimental@5.90.14 @tanstack/query-devtools@5.91.1 @tanstack/react-query-devtools@5.91.1 @tanstack/solid-query-devtools@5.91.1 @tanstack/svelte-query-devtools@6.0.2 @tanstack/vue-query-devtools@6.1.1
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-25 10:50:04 +00:00
Matthew Costabile
b261b6f29e
fix(devtools): Improve devtools accessibility by adding aria attributes, using semantic components and field labels (#9806)
* update devtool a11y

* changeset

* ci: apply automated fixes

* Update packages/query-devtools/src/Devtools.tsx

* unnecessary role

* label -> input

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-25 11:44:47 +01:00
Mateusz Burzyński
c9bc6002ad
chore: use better Thrower declaration in tests (#9884)
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-11-23 10:55:09 +01:00
Wonsuk Choi
ae47807851
test(react-query-persist-client/PersistQueryClientProvider): switch to fake timers, replace 'await' with 'advanceTimersByTimeAsync', and use 'sleep().then()' pattern (#9859) @tanstack/angular-query-experimental@5.90.13 @tanstack/query-devtools@5.91.0 @tanstack/react-query-devtools@5.91.0 @tanstack/solid-query-devtools@5.91.0 @tanstack/svelte-query-devtools@6.0.1 @tanstack/vue-query-devtools@6.1.0
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
2025-11-22 14:59:26 +09:00
github-actions[bot]
18febbd79a
ci: Version Packages (#9890)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-21 10:46:41 +00:00
Damian Osipiuk
0e9d5b5652
feat(devtools): allow passing a theme via prop (#9887) 2025-11-21 11:45:27 +01:00
github-actions[bot]
66a194e6b1
ci: Version Packages (#9879) @tanstack/angular-query-experimental@5.90.12 @tanstack/query-async-storage-persister@5.90.12 @tanstack/query-broadcast-client-experimental@5.90.10 @tanstack/query-core@5.90.10 @tanstack/query-persist-client-core@5.91.9 @tanstack/query-sync-storage-persister@5.90.12 @tanstack/react-query-persist-client@5.90.12 @tanstack/react-query@5.90.10 @tanstack/solid-query-persist-client@5.90.13 @tanstack/solid-query@5.90.13 @tanstack/svelte-query-persist-client@6.0.10 @tanstack/svelte-query@6.0.8 @tanstack/vue-query@5.91.2
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-16 18:27:14 +00:00
ahmethos
eb559a66dc
fix(streamedQuery): fall back to initialValue when stream yields no values (#9876)
* fix(streamedQuery): fall back to initialValue when stream yields no values

Add failing test for empty streams and update implementation to avoid returning undefined.
Includes changeset for patch release.

* chore: address review nitpicks (JSDoc + test cleanup)

* docs: note that initialValue is returned when the stream yields no values

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-11-16 19:19:44 +01:00