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

5,194 commits

Author SHA1 Message Date
Corbin Crutchley
ed21249708
fix(angular-query) fix injectQueries types
* fix(angular-query-experimental): typings for injectQueries should now behave properly

* fix(angular-query-experimental): behaviors of injectQuery now work at runtime

Mostly

* ci: apply automated fixes

* add signal proxy

* ci: apply automated fixes

* update @testing-library/angular

* fix build

* rename test file

* ci: apply automated fixes

* fix type error

* apply corerabbit suggestions

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Arnoud de Vries <6420061+arnoud-dv@users.noreply.github.com>
2025-09-18 19:50:58 +02:00
Tanner Linsley
2a00fb6504 release: v5.89.0 v5.89.0 2025-09-16 08:27:49 +00:00
Josh
a2151d28e1
feat(query-core): add context to mutationfn & mutation callbacks (#9615)
* feat(query-core): add context to mutationfn

Co-Authored-By: travikk <627275+travikk@users.noreply.github.com>

* fix(query-core): mutation onSuccess scope param should also be undefined

Co-Authored-By: travikk <627275+travikk@users.noreply.github.com>

* feat: add scope deprecate context on mutation state

* feat(query-core): add mutation context to all mutation callbacks

* chore: pr amends

Co-Authored-By: Dominik Dorfmeister <1021430+TkDodo@users.noreply.github.com>

* test(unit): update to handle context in mutation callbacks

* chore: rename to onMutateResult

* chore: revert context deprecation on MutationState

---------

Co-authored-by: travikk <627275+travikk@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister <1021430+TkDodo@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-09-16 10:22:43 +02:00
renovate[bot]
0e99327e15
chore(deps): update marocchino/sticky-pull-request-comment digest to a071bc9 (#9627)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-16 10:13:05 +02:00
Tanner Linsley
66df21102f release: v5.88.0 v5.88.0 2025-09-15 22:12:11 +00:00
Arnoud
e75a5f9d55
feat(angular-query): move devtools to conditional sub-paths (#9270)
* feat(angular-query-devtools): move devtools to conditional sub-paths, improves tree shaking and dependency injection

* Fix compatibility with moduleResolution node

* ci: apply automated fixes

* fix preview release for angular-query

* Fix angular-query preview release

* Revert some changes made obsolete by better Vite based alternative

* Update export paths

* Fix production exports and publishconfig

* knip config

* remove postpack

* Generate API reference docs

* type declarations in correct directory

* Update documentation

* knip config

* Optional core devtools dependency

* ci: apply automated fixes

* regenerate api reference docs

* ci: apply automated fixes

* ci: apply automated fixes (attempt 2/3)

* regenerate api reference docs

* formatting

* apply coderabbit suggestions

* Improve unit tests

* docs

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-09-16 00:07:53 +02:00
Tanner Linsley
2b0d97abc6 release: v5.87.5 v5.87.5 2025-09-15 00:36:06 +00:00
Arnoud
ca56514d39
refactor(angular-query): move injectQueries to sub-path export (#9655) 2025-09-15 02:33:04 +02:00
Sarah
6492aed7be
docs: Readme fix (#9652)
* remove css and fix layout

* fix readme and remove css

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-09-14 08:48:04 +02:00
Arnoud
94ee0ebeff
docs(angular-query): improve mutationOptions jsdoc code example (#9648) 2025-09-12 17:11:19 +02:00
Arnoud
e3b40d4d0d
chore(angular-query): remove standalone component markers as it's now the default (#9647) 2025-09-12 15:09:42 +02:00
Sarah
d179168d74
docs: README Updates (#9640)
* readme updates

* fix devtools link

* Apply suggestion from @coderabbitai[bot]

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update README.md

Co-authored-by: Sarah <hello@sarahgerrard.me>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-09-12 11:20:50 +02:00
Arnoud
2492ed1d9b
docs(angular-query): fix error in code snippet (#9645) 2025-09-12 01:31:48 +02:00
Pascal Weyrich
7f0e7161e4
docs(angular-query): use signal input in placeholder-query-data.md (#9641) 2025-09-12 00:16:24 +02:00
Tanner Linsley
230435d112 release: v5.87.4 v5.87.4 2025-09-10 14:10:04 +00:00
Minha Kang
19445a00c0
fix(query-core): infinite re-renders in useQueries (#9639)
* test(useQueries): add test for preventing infinite re-renders

* fix(query-core): resolve infinite re-renders in queriesObserver

* style(useQueries): remove unnecessary comments

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-09-10 16:05:43 +02:00
Wonsuk Choi
ccedf3328f
test(svelte-query/createMutation): improve callback assertions with 'toHaveBeenNthCalledWith' and apply shorthand property syntax in FailureExample (#9630) 2025-09-08 14:58:06 +02:00
Tanner Linsley
2bf8fa3175 release: v5.87.3 v5.87.3 2025-09-08 12:51:41 +00:00
Ji-hoon Choi
af50368d76
fix(query-devtools): add work break to code element to prevent DevPanel from expanding (#9625)
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-09-08 14:48:04 +02:00
amir hossein Agha alikhani
f023881656
docs: update fetchNextPage condition in Example component (#9626)
Co-authored-by: Alikhani <alikhani.am@yepco.ir>
2025-09-08 14:36:18 +02:00
Zakaria Abu Sarah ザカリヤ
f49cc75e4a
docs: Remove fragment in disabling-queries guide (#9619)
Fragment is not needed here
2025-09-05 16:48:13 +02:00
Tanner Linsley
92d6b7bc86 release: v5.87.2 v5.87.2 2025-09-05 14:37:39 +00:00
Alem Tuzlak
3af530d657
fix(solid-query-devtools): fix typing issue (#9621)
* fix: fix issue with solid devtools

* fix: add correct jsx typing from solid

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-09-05 16:18:21 +02:00
Tanner Linsley
bc2c87fceb release: v5.87.1 v5.87.1 2025-09-05 14:15:20 +00:00
Dominik Dorfmeister
1c8a921677
fix(query-core): update initialData when an observer mounts while a Query without data exists (#9620)
initialData gives the guarantee that data cannot be undefined, but this falls short when you create a Query via prefetching, and then mount the observer that has initialData set.

That's because initialData is only doing something in the constructor of the Query, so if the Observer isn't the one who creates the Query, it does nothing

This fix makes sure that when new options are applied on a Query (which e.g. happens when an observer mounts), initialData is taken into account when the Query doesn't have any data yet
2025-09-05 16:13:31 +02:00
Tanner Linsley
b43af57cd2 release: v5.87.0 v5.87.0 2025-09-05 11:55:19 +00:00
Jake Teton-Landis
a0b96db937
feat(query-core): add timeoutManager to allow changing setTimeout/setInterval (#9612)
* add timeoutManager class

* add additional types & export functions

* convert all setTimeout/setInterval to managed versions

* tweaks

* add claude-generated tests

* tests

* revert changes in query-async-storage-persister: no path to import query-core

* re-export more types

* console.warn -> non-production console.error

* query-async-storage-persister: use query-core managedSetTimeout

* pdate pnpm-lock for new dependency edge

* sleep: always managedSetTimeout

* remove managed* functions, call method directly

* remove runtime coercion and accept unsafe any within TimeoutManager class

* cleanup; fix test after changes

* name is __TEST_ONLY__

* notifyManager: default scheduler === systemSetTimeoutZero

* Improve TimeoutCallback comment since ai was confused

* remove unnecessary timeoutManager-related exports

* prettier-ify index.ts (seems my editor messed with it already this pr?)

* continue to export defaultTimeoutProvider for tests

* oops missing import

* fix: export systemSetTimeoutZero from core

* ref: use notifyManager.schedule in createPersister

because it needs to work with whatever scheduleFn we have set there

* ref: move provider check behind env check

* docs

* doc tweaks

* doc tweaks

* docs: reference timeoutManager in discussion of 24 day setTimout limit

* Apply suggestion from @TkDodo

* Apply suggestion from @TkDodo

* chore: fix broken links

* docs: syntax fix

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-09-05 13:37:09 +02:00
Arnoud
2283633684
docs(angular-query): update Angular Zoneless doc (#9616) 2025-09-04 14:05:23 +02:00
Tanner Linsley
1599bb4742 release: v5.86.0 v5.86.0 2025-09-04 09:27:33 +00:00
Dominik Dorfmeister
b25412a9e3
ref: rename queryFn to streamFn in streamedQuery (#9606)
* ref: rename queryFn to streamFn in streamedQuery

this avoids the weirdly double-nested queryFn naming

* chore: docs

* fix: docs
2025-09-04 11:19:15 +02:00
marco gobbi
8f24580fda
feat(query-core): add custom reducer support to streamedQuery (#9532)
* feat(query-core): add custom reducer support to streamedQuery

Replace maxChunks parameter with flexible reducer function that delegates
data aggregation to consumer code. This provides full control over how
streamed chunks are combined into the final data structure.

Add support for custom placeholderData that works seamlessly with the
reducer function, allowing initialization of complex data types beyond
simple arrays.

https://github.com/TanStack/query/discussions/9065

BREAKING CHANGE: The maxChunks parameter has been removed from streamedQuery.
Use a custom reducer function to control data aggregation behavior instead.

* ci: apply automated fixes

* feat(query-core): require initialValue when using custom reducer in streamedQuery

Add type safety by making initialValue mandatory when providing a custom
reducer function. This prevents runtime errors and ensures proper data
initialization for custom data structures beyond simple arrays.

Use conditional types to enforce the relationship between reducer and
initialValue parameters, maintaining backward compatibility for simple
array-based streaming while requiring explicit initialization for
custom reducers.

BREAKING CHANGE: When using a custom reducer function with streamedQuery,
the initialValue parameter is now required and must be provided.

* feat(query-core): require initialValue when using custom reducer in streamedQuery

Add type safety by making initialValue mandatory when providing a custom
reducer function. This prevents runtime errors and ensures proper data
initialization for custom data structures beyond simple arrays.

Use conditional types to enforce the relationship between reducer and
initialValue parameters, maintaining backward compatibility for simple
array-based streaming while requiring explicit initialization for
custom reducers.

BREAKING CHANGE: When using a custom reducer function with streamedQuery,
the initialValue parameter is now required and must be provided.

* feat(query-core): require initialValue when using custom reducer in streamedQuery

Add type safety by making initialValue mandatory when providing a custom
reducer function. This prevents runtime errors and ensures proper data
initialization for custom data structures beyond simple arrays.

Use conditional types to enforce the relationship between reducer and
initialValue parameters, maintaining backward compatibility for simple
array-based streaming while requiring explicit initialization for
custom reducers.

BREAKING CHANGE: When using a custom reducer function with streamedQuery,
the initialValue parameter is now required and must be provided.

* removed personal vscode workspace file

* updated documentation

* fix(docs): clarify reducer function description in streamedQuery documentation

* ci: apply automated fixes

* fix(tests): Code Review :: update streamedQuery tests to use correct initialValue type

---------

Co-authored-by: gobbimar <marco.gobbi@adidas.com>
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-09-04 11:03:41 +02:00
Wonsuk Choi
43049c5534
test(react-query/useMutationState): clarify assertions and improve code formatting (#9611) 2025-09-03 10:35:56 +02:00
Wonsuk Choi
7306474eee
chore(tsconfig.json): simplify 'include' patterns by consolidating file extensions and directory paths (#9547)
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-09-03 09:56:51 +02:00
BennettLiam
c75a994ca2
Fix svelte optimistic updates example (#8005)
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
2025-09-03 10:31:45 +09:00
Tanner Linsley
0a35234ce4 release: v5.85.9 v5.85.9 2025-09-02 12:17:18 +00:00
Kim YoungHoon
564a4f6e19
fix(query-core): ensure combine re-executes after cache restoration with memoized combine (#9592)
* fix(query-core): ensure combine re-executes after cache restoration with memoized combine

* fix(query-core): add error field to result change detection

* test(query-core): add test for QueriesObserver early return notification

* test(query-core): improve test for QueriesObserver early return notification

* refactor(query-core): use shallowEqualObjects for result comparison

* refactor(query-core): improve setQueries flow and fix persist/restore issue with memoized combine

* refactor(query-core): improve setQueries flow and remove log

* test(react-query): update useQueries expectations for metadata change detection

* test(react-query): fix test comments

* test(react-query): add test for stable combine optimization on unrelated re-renders

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-09-02 14:12:59 +02:00
Wonsuk Choi
5221029907
test(react-query/HydrationBoundary): add tests for 'non-object' state and missing 'queries' property handling (#9605)
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
2025-09-02 17:24:46 +09:00
Tanner Linsley
aec19c93a5 release: v5.85.8 v5.85.8 2025-09-02 07:59:16 +00:00
autofix-ci[bot]
c44ca473e4
ci: apply automated fixes 2025-09-02 07:54:17 +00:00
Minha Kang
ef0c16ecb1
refactor(react-query): replace magic number with named constant in suspense timers (#9607) 2025-09-02 09:53:28 +02:00
Tanner Linsley
a978b34b1b release: v5.85.7 v5.85.7 2025-09-02 07:22:33 +00:00
Flo
7d24156159
refactor(query-core): improve replaceEqualDeep performance (#9604)
* refactor(query-core): improve replaceEqualDeep performance

* try object.prototype that broke eslint in router

* no object flag

* improved version w/ more code

* ci: apply automated fixes

* less code, but still 2x faster

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-09-02 09:18:20 +02:00
Vlad Kovechenkov
f97d7258a0
docs: mention second parameter for cancelQueries (#9597)
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
2025-09-02 12:08:19 +09:00
Imad Selka
0650eaf116
docs: clarify queryClient refetch behavior for stale queries (#9560)
* docs(queryClient): add example for refetchQueries with stale: true and type: active

* docs(react-native): modify useRefreshOnFocus example

* docs(react-native): add queryKey in useRefreshOnFocus example

* Apply suggestion from @TkDodo

* 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-09-01 12:53:17 +02:00
Tanner Linsley
b998f68a57 release: v5.85.6 v5.85.6 2025-08-30 12:21:11 +00:00
Dominik Dorfmeister
379670dd0a
fix(core): make sure queries revert synchronously (#9601)
the switch from the callback approach to async/await with catch was necessary to be able to transform errors into revert-state data for imperative query calls; however, this was a change in behavior because catch in async/await doesn't happen immediately - it runs in the next microtask. That opened up an opportunity for a slight race condition if we re-start a fetch in-between. And who does that? Of course, React Strict Mode.

This PR moves the actual state reverting back to a callback (so it happens synchronously), while still keeping the try/catch refactoring merely to transform the promise and the usual error handling
2025-08-30 14:19:17 +02:00
우혁
428c19fa33
docs: update mutation status type (#9595)
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
2025-08-30 14:47:27 +09:00
우혁
2a8ba49919
docs: remove unnecessary trailing comma (#9594)
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
2025-08-30 14:44:30 +09:00
우혁
54efe225b6
docs: fix type definitions in useQuery options (union, parameters, extra parentheses) (#9596)
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
2025-08-30 14:36:19 +09:00
우혁
ad0ca9f37c
docs: fix missing comma in useMutation example to prevent syntax errors (#9593)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-30 14:28:48 +09:00