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

4,997 commits

Author SHA1 Message Date
Braden Wong
982f6ca607
refactor(types): narrow onSuccess/onError/onMutate/onSettled callback types to Promise<void> | void (#9202)
* refactor: narrow onSuccess/onError/onMutate/onSettled callback types to Promise<void> | void

Previously, the `onSuccess`, `onError`, `onMutate`, and `onSettled` callbacks were typed as `() => Promise<unknown> | unknown`. While `unknown` is technically valid, it implies that the return value might be used, assigned, or further processed. However, throughout the codebase, these callbacks are invoked solely for their side effects, and their return values are always ignored. Narrowing the type to `Promise<void> | void` makes this intent explicit, clarifies that any return value will be discarded, and prevents misleading type signatures that suggest otherwise.

This commit narrows their types to `() => Promise<void> | void`, which more accurately reflects their intended use.

* docs: update callback return types to Promise<void> | void in mutation-related documentation

This commit refines the documentation for mutation-related callbacks (`onSuccess`, `onError`, `onSettled`, and `onMutate`), changing their return types from `Promise<unknown> | unknown` to `Promise<void> | void`.
2025-06-02 18:09:24 +02:00
Tanner Linsley
7cf6ef515f release: v5.79.0 v5.79.0 2025-05-29 09:42:36 +00:00
Dominik Dorfmeister
b475d21568
feat(core): staleTime: 'static' (#9139)
* feat(core): StaleTime.Static

* fix: consider StaleTime.Static for invalidation

previously, it didn't matter if we included `stale: true` or not in the filters for refetch, because marking things with query.invalidate() would set them all to stale anyway.

Now, queries with StaleTime.Static will be marked as `invalidated`, but still shouldn't be refetched. The `isStale` filter logic accounts for that, so we have to include it in the filters

* fix: isStale order check

check for observers first because they contain the source of truth calculated with `isStaleByTime`, and it also takes enabled into account

* fix: isStaleByTime logic

we have to check for undefined data first, because queries without data are really always stale; then, the next check must be against StaleTime.Static, because queries that are marked as invalidated are still not stale, even if they are static.

* tests

* fix: type issue in react

* fix: make sure invalidation _always_ only refetches stale queries

this ensures we never refetch Static queries

* fix: never refetch static queries

* fix: make sure we don't refetchOn... for StaleTime.Static even when 'always' is set

* docs: StaleTime.Static

* ref: switch to 'static' string

* docs
2025-05-29 11:40:52 +02:00
Dominik Dorfmeister
34eedd601c
chore: update to eslint-plugin-react-hooks v6 (#9071)
* chore: update to eslint-plugin-react-hooks v6

and remove the separate compiler linter plugin, as those rules are now integrated

* chore: disable compiler-linter in tests

* chore: bypass lint violations

* chore: Disable '@eslint-react/no-context-provider'

to be react 18 compatible
2025-05-29 11:09:26 +02:00
Arnoud
9e30aafa0b
chore(angular-query): update to angular 20 stable (#9209) 2025-05-28 21:12:03 +02:00
Tanner Linsley
7a6733f75b release: v5.78.0 v5.78.0 2025-05-26 13:28:10 +00:00
jochong
a1210cbf81
feat(eslint-plugin): refactor and add mutation-property-order rule (#9191)
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-05-26 15:18:56 +02:00
Tanner Linsley
f2aa150774 release: v5.77.2 v5.77.2 2025-05-26 12:08:18 +00:00
Jonghyeon Ko
b2af5689f3
refactor: centralize NonUndefinedGuard type definition (#9187)
Moved the NonUndefinedGuard type definition to the query-core package for better reusability across various query options files in angular, react, solid, svelte, and vue packages. Removed duplicate definitions from individual files.
2025-05-26 14:03:44 +02:00
Tanner Linsley
318ba4d92e release: v5.77.1 v5.77.1 2025-05-25 21:15:14 +00:00
Fredrik Höglund
d4b78185b3
fix(core): do not hydrate promises if existing query is already fetching 2025-05-25 23:09:52 +02:00
Rodrigo Monney
f2b6cafe23
docs: Update overview.md (#9181)
Standardize the bullet point sentences to not have a period at the end (some have it, others don't)
2025-05-24 10:04:02 +02:00
Tanner Linsley
60ed69c3f5 release: v5.77.0 v5.77.0 2025-05-24 07:23:48 +00:00
Dominik Dorfmeister
9973e0f1d8
feat: maxChunks (#9184) 2025-05-24 09:22:00 +02:00
TkDodo
719db3540e chore(✂️): remove ts-node to make knip happy 2025-05-24 09:03:15 +02:00
MINSEONG KIM
268e4f2d6c
test(query-core): add test case for query (#9145)
* test(query-core): add test case for query

* test(query-core): use hashQueryKeyByOptions

* add test case about "should call initialData function when it is a function"

* reflect feedback

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-05-24 08:50:37 +02:00
autofix-ci[bot]
7b0aaab005
ci: apply automated fixes (attempt 2/3) 2025-05-24 06:50:01 +00:00
autofix-ci[bot]
20c36c8bf3
ci: apply automated fixes 2025-05-24 06:48:59 +00:00
Tanner Linsley
afc6302dbf docs: fix links
commit 113eb6ba963534fe80b3e96193d767bf769c8bff
Author: Tanner Linsley <tannerlinsley@gmail.com>
Date:   Fri May 23 23:16:11 2025 -0600

    docs: fix: only transform generated reference

commit d1d084ed9026e31ba746e1bb87d5c19183a7d148
Author: Tanner Linsley <tannerlinsley@gmail.com>
Date:   Fri May 23 23:12:07 2025 -0600

    docs: fix broken links

commit 0df59ea7d8afb16be86ae917fc46900b6e999351
Author: Tanner Linsley <tannerlinsley@gmail.com>
Date:   Fri May 23 15:54:19 2025 -0600

    fix: rewrite type doc links to be directory-relative

commit 81e4c71f1c9250005f164b7e585837ee0ad14e23
Author: Tanner Linsley <tannerlinsley@gmail.com>
Date:   Fri May 23 15:14:51 2025 -0600

    fix: initial fix for ./ => ../
2025-05-24 00:47:55 -06:00
Dominik Dorfmeister
1b9837f969
chore: remove baseUrl from tsConfig, as it's deprecated (#9178)
* chore: remove baseUrl from tsConfig, as it's deprecated

* ci: apply automated fixes

* test: fix import

* chore: Unused item in ignoreDependencies

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-23 11:21:19 +02:00
Tanner Linsley
80dd0db3c7 release: v5.76.2 v5.76.2 2025-05-22 15:40:29 +00:00
Fredrik Höglund
9f5fba3a88
fix(core): fix promise hydration bugs (#9157)
* test(hydration): implement missing hydration tests

* Do not hydrate older promises
* Do not infinite loop on hydrating failed promises
* Hydrate already resolved promises immediately

* fix(hydration): fix promise hydration bugs

* Include dehydratedAt and ignore hydrating old promises
  * This is an approximation of dataUpdatedAt, but is not perfect
* Refactor checks for if we should hydrate promises or not to fix infinite loop bug on failed queries
* Hydrate already resolved promises synchronously

* call query.fetch even if sync data was available

* use noop function in tryResolveSync .catch

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2025-05-22 17:35:08 +02:00
László Bucsai
09a55bf297
docs: update infinite query fetchNextPage examples (#9172) 2025-05-22 17:32:31 +02:00
차승하
065b5f4317
chore: disable the ESLint rule that removes Context.Provider (#9162)
* style: disable the ESLint rule that removes Context.Provider

* fix: correct grammartic mistake
2025-05-18 16:43:59 +02:00
shagag
c1142b923b
docs(react-query): Small rephrase of adavnced-ssr.md (#9152)
“Let’s next look” – This is slightly awkward
2025-05-15 21:03:06 +02:00
Arnoud
8b4e0bd0b3
chore(angular-query): update to angular 20 RC (#9153)
* chore(angular-query): update to angular 20

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-15 14:45:43 +02:00
MINSEONG KIM
2be8cca104
test(query-core): add test case for queryObserver (#9146)
* test(query-core): add test case for queryObserver

* fix test
2025-05-14 15:39:34 +02:00
Tanner Linsley
5c9bd115e0 release: v5.76.1 v5.76.1 2025-05-13 22:04:34 +00:00
Damian Osipiuk
65ef198ad8
fix(experimental_createQueryPersister): return more utilities, rename persister (#8062)
* fix(experimental_createQueryPersister): return more utilities, rename persister

* chore: some docs

* test: add tests for utilities

* ci: apply automated fixes

* fix: add missing await

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-13 23:39:40 +02:00
Tanner Linsley
08cb4b6577 release: v5.76.0 v5.76.0 2025-05-12 09:07:27 +00:00
MINSEONG KIM
c89c6a0bab
test(query-core): add test case for InfiniteQueryObserver (#9141) 2025-05-12 11:02:19 +02:00
Austin Johnson
696fd443c7
feat(devtools): 🏝️ TanStack Query DevTools for Expo/React Native! 🚀 (#8846)
* test

* feat(devtools): add action event types and notify functionality for query actions

* cleanup commeny

* fix(devtools): update notifyDevtools to use queryClient for all action notifications

* remove dup call

* Fix online manager bug not syncing correctly

* Update docs

* Fix default case error due to additional events from dev tools.

* Add events

* ci: apply automated fixes

* Remove no longer needed code

* ci: apply automated fixes

* revert previous change

* undo minor text change

* ci: apply automated fixes

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

* Apply suggestions from code review

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-12 11:00:57 +02:00
Lachlan Collins
6a52926562
test(react-query): initiate queryClient in beforeEach (#9142) 2025-05-12 14:56:10 +10:00
Tanner Linsley
81aa02bc18 release: v5.75.8 v5.75.8 2025-05-09 14:50:03 +00:00
Arnoud
4b0f79fb4b
fix(angular-query): allow providing on element injectors (#9134) 2025-05-09 16:37:44 +02:00
Tanner Linsley
b1e0c9fd28 release: v5.75.7 v5.75.7 2025-05-09 13:40:52 +00:00
novice0840
07cbfe1b36
refactor(react-query): exchange react-query noop to query-core noop (#9122)
* refactor: exchange react-query noop to query-core noop

* ci: apply automated fixes

* fix: resolve import error

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-09 15:34:43 +02:00
Dovakeidy
cb40661209
docs(comparison): mark RTK Query as supporting infinite queries (#9120)
RTK Query now supports infinite queries as introduced in Redux Toolkit v2.6.0. This feature allows efficient pagination handling through useInfiniteQuery, with built-in support for fetching next/previous pages and managing paginated cache state.

Docs: https://redux-toolkit.js.org/rtk-query/usage/infinite-queries
Release: https://github.com/reduxjs/redux-toolkit/releases/tag/v2.6.0
2025-05-09 12:20:50 +02:00
Tanner Linsley
3da0c7ecdd release: v5.75.6 v5.75.6 2025-05-09 09:31:14 +00:00
novice0840
295a5d586f
refactor: integration should throw error (#9130)
* feat(query-core): made "shouldThrowError" function

* refactor(react-query): apply "shouldThrowError" function in react-query package

* refactor(angular-query-experimental): apply "shouldThrowError" function

* refactor(solid-query): apply "shouldThrowError" function

* refactor(vue-query): apply "shouldThrowError" function

* test: add shouldThrowError function test
2025-05-09 11:26:54 +02:00
novice0840
e0ea8f22f2
docs: remove unnecessary text (#9131) 2025-05-09 11:24:37 +02:00
Arnoud
57251a4e24
feature(angular-query): support providing QueryClient via an InjectionToken (#9128)
This is useful for example in thin app shell applications where feature teams provide their dependencies on lazy loaded route providers while still allowing to easily share a QueryClient.

This way the main bundle for the app shell does not include TanStack Query.
2025-05-08 21:52:29 +02:00
autofix-ci[bot]
8f092f9e4a
ci: apply automated fixes 2025-05-08 16:23:54 +00:00
Tanner Linsley
6ee1e666fe
Update README.md 2025-05-08 10:22:43 -06:00
autofix-ci[bot]
37d8eb6ff9
ci: apply automated fixes 2025-05-08 16:20:30 +00:00
Tanner Linsley
32414aab2f
Update README.md 2025-05-08 10:19:18 -06:00
xxziiko
3d64dc60f1
docs(react-query): ensure suspense example fallback renders correctly (#9119)
The previous suspense example incorrectly rendered null instead of the
fallback UI. This change moves the null check outside the Suspense
component to ensure the fallback is displayed as expected.

Fixes #9019
2025-05-08 13:17:25 +02:00
Jonghyeon Ko
66ea5f2fcc
chore: add typescript-eslint/require-await rule (#9116)
Co-authored-by: MINSEONG KIM <65233075+minseong0324@users.noreply.github.com>
2025-05-08 04:48:20 +09:00
김석진(poki)
2a62ea1ff1
test(react-query): improve branch coverage for useSuspenseQuery skipToken error handling (#9112)
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
2025-05-08 02:43:56 +09:00
김석진(poki)
b1cdbc3fd9
test(react-query): improve branch coverage for useSuspenseQueries skipToken error handling (#9113)
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
2025-05-08 02:38:24 +09:00