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

5,395 commits

Author SHA1 Message Date
Dami Oyeniyi
aeb5fa0dc0
docs(examples): fix Vue example README headings (#10432) 2026-04-09 10:33:07 +02:00
Dami Oyeniyi
05771b1c2a
docs(examples): guard the react shadow-dom mount target (#10431) 2026-04-09 10:32:43 +02:00
Dami Oyeniyi
c945694007
docs(examples): fix Solid README dev commands (#10430) 2026-04-09 10:32:00 +02:00
Byungsker
23a4029c9a
feat(eslint-plugin-query): add ESLint v10 to peer dependencies (#10182)
* feat(eslint-plugin-query): add ESLint v10 to peer dependencies

* fix: bump @typescript-eslint/utils to ^8.56.0 for ESLint v10 peer support

* chore: fix lockfile

* add typescript v6 support

* Apply suggestions from code review

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>

---------

Co-authored-by: TkDodo <office@dorfmeister.cc>
2026-04-09 10:31:00 +02:00
semimikoh
2bfb12cc44
fix(query-core): clear timers when timer ID is 0 (#10401)
* fix(query-core): use explicit undefined check for timer IDs

  Custom TimeoutProvider implementations may return 0 as a valid timer
  ID (e.g. a counter-based provider), but the existing truthy checks
  treated 0 as "no timer" and skipped clearTimeout/clearInterval. This
  left stale timers running, causing unexpected refetches and GC leaks.

  Compare against undefined instead, matching the optional `?:
  ManagedTimerId` field types.

  Fixes #10395

* chore: add changeset for #10395

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-04-09 09:26:00 +02:00
Wonsuk Choi
48c3975afb
test(query-core): replace 'async/await sleep' with 'sleep().then()' in test 'queryFn' and 'mutationFn' (#10435) 2026-04-09 10:46:52 +09:00
Wonsuk Choi
6b95cd871a
test(query-core): replace 'vi.waitFor' with 'vi.advanceTimersByTimeAsync' in 'query.test.tsx' (#10434) 2026-04-09 09:41:31 +09:00
Wonsuk Choi
ef62f7b0ac
test(query-core/hydration): replace 'vi.waitFor' with 'vi.advanceTimersByTimeAsync' (#10428)
* test(query-core/hydration): replace 'vi.waitFor' with 'vi.advanceTimersByTimeAsync'

* ci: trigger CI
2026-04-08 10:31:14 +09:00
Wonsuk Choi
2e26f14a41
test(query-core): replace hardcoded query keys with 'queryKey()' utility (#10425)
* test(query-core): replace hardcoded query keys with 'queryKey()' utility

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-08 03:28:04 +09:00
Wonsuk Choi
79dee50d56
test(query-core/mutationCache): add test for removing a mutation that does not exist in the cache (#10423)
* test(query-core/mutationCache): add test for removing a mutation that does not exist in the cache

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-08 01:33:49 +09:00
Wonsuk Choi
f6991900dc
test(react-query): replace hardcoded query keys with 'queryKey()' utility (#10420)
* test(react-query): replace hardcoded query keys with 'queryKey()' utility

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-07 16:46:01 +09:00
Wonsuk Choi
389bbca956
test(preact-query): replace hardcoded query keys with 'queryKey()' utility (#10419) 2026-04-07 15:38:54 +09:00
Wonsuk Choi
4335fce4ae
test(angular-query-experimental): replace hardcoded query keys with 'queryKey()' utility (#10418) 2026-04-07 13:41:37 +09:00
Wonsuk Choi
dbe3f957c2
test(vue-query): replace hardcoded query keys with 'queryKey()' utility (#10417) 2026-04-07 12:21:22 +09:00
Wonsuk Choi
d9384ac630
test(solid-query): replace hardcoded query keys with 'queryKey()' utility (#10416) 2026-04-07 11:25:11 +09:00
Wonsuk Choi
e203306f5e
test(svelte-query): replace hardcoded query keys with 'queryKey()' utility (#10415) 2026-04-07 10:57:24 +09:00
Wonsuk Choi
f3d3eea76b
test(*): replace deprecated 'toMatchTypeOf' with 'toExtend' (#10413) 2026-04-07 00:39:33 +09:00
Wonsuk Choi
cf82e86b47
test({solid,svelte}-query): add missing 'initialData' describe nesting in type test files (#10412)
* test({solid,svelte}-query): add missing 'initialData' describe nesting in type test files

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-06 23:58:21 +09:00
Wonsuk Choi
2a4fc9f04f
test(angular-query-experimental): fix 'describe' nesting and naming in type test files (#10411)
* test({solid,svelte,angular}-query): add missing 'initialData' describe nesting and wrap with top-level describe

* ci: apply automated fixes

* test(angular-query-experimental): fix incorrect 'describe' name in 'inject-queries.test-d.ts' and 'inject-mutation.test-d.ts'

* ci: apply automated fixes

* revert: remove solid-query and svelte-query changes from this PR

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-06 23:46:31 +09:00
Wonsuk Choi
fc35bbf4b5
test({solid,svelte}-query): fix incorrect 'describe' name from 'initialData' to match file name (#10410) 2026-04-06 23:03:00 +09:00
Wonsuk Choi
a8dc3b7228
test(svelte-query/infiniteQueryOptions): fix incorrect 'describe' name from 'queryOptions' to 'infiniteQueryOptions' (#10409) 2026-04-06 22:54:16 +09:00
Wonsuk Choi
36fc645a87
test({solid,svelte}-query/mutationOptions): replace 'toStrictEqual' with 'toBe' for identity check (#10407)
* test({react,preact}-query/infiniteQueryOptions): replace type annotation with 'as const'

* Revert "test({react,preact}-query/infiniteQueryOptions): replace type annotation with 'as const'"

This reverts commit 2bb0029621.

* test({solid,svelte}-query/mutationOptions): replace 'toStrictEqual' with 'toBe' for identity check
2026-04-06 22:43:08 +09:00
Wonsuk Choi
1a6fdd0b95
test({solid,vue}-query/infiniteQueryOptions): add runtime test for 'infiniteQueryOptions' (#10406) 2026-04-06 21:49:25 +09:00
Wonsuk Choi
e919c54f86
test(*): replace deprecated 'toThrowError' with 'toThrow' (#10405) 2026-04-06 21:32:42 +09:00
Wonsuk Choi
1493433c34
test(angular-query-experimental): replace 'async/await sleep' with 'sleep().then()' in test 'queryFn' and 'mutationFn' (#10404)
* test(angular-query-experimental): replace 'async/await sleep' with 'sleep().then()' in test 'queryFn' and 'mutationFn'

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-06 19:54:01 +09:00
Wonsuk Choi
3d6e001bae
test(react-query/useSuspenseQueries): replace 'async/await sleep' with 'sleep().then()' in 'queryFn' (#10403) 2026-04-06 19:19:27 +09:00
Wonsuk Choi
eac62b8593
test(preact-query): replace 'async/await sleep' with 'sleep().then()' in test 'queryFn' and 'mutationFn' (#10400)
* test(preact-query): replace 'async/await sleep' with 'sleep().then()' in test 'queryFn' and 'mutationFn'

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-06 15:25:33 +09:00
Wonsuk Choi
7d7a21c49c
test(react-query): replace 'async/await sleep' with 'sleep().then()' in test 'queryFn' and 'mutationFn' (#10399)
* test(react-query): replace 'async/await sleep' with 'sleep().then()' in test 'queryFn' and 'mutationFn'

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-06 13:52:50 +09:00
Wonsuk Choi
ef2a4e3f6c
test(solid-query): replace 'async/await sleep' with 'sleep().then()' in test 'queryFn' and 'mutationFn' (#10398) 2026-04-06 13:25:59 +09:00
Wonsuk Choi
abf854764b
test(svelte-query): replace 'async/await sleep' with 'sleep().then()' in test 'queryFn' and 'mutationFn' (#10397) 2026-04-06 10:39:51 +09:00
Wonsuk Choi
e76d47640e
test(svelte-query/createQuery): fix 'it.todo' for different stale times by advancing timer before query creation (#10396)
* test(svelte-query/createQuery): fix 'it.todo' for different stale times by advancing timer before query creation

* ci: apply automated fixes

* test(svelte-query/createQuery): reduce 'advanceTimersByTimeAsync' from 11 to 10 to match 'staleTime: 10'

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-06 10:05:12 +09:00
Wonsuk Choi
3a993e6e6f
test(svelte-query/createQuery): switch to fake timers, replace 'vi.waitFor' with 'vi.advanceTimersByTimeAsync', and move 'queryClient' to 'beforeEach' (#10390)
* test(svelte-query/createQuery): switch to fake timers, replace 'vi.waitFor' with 'vi.advanceTimersByTimeAsync', and move 'queryClient' to 'beforeEach'

* test(svelte-query/createQuery): use 'QueryCache' type instead of 'ReturnType' for 'queryCache'

* ci: apply automated fixes

* test(svelte-query/createQuery): reduce 'advanceTimersByTimeAsync' from 100 to 11 for staleTime test

* test(svelte-query/createQuery): fix 'advanceTimersByTimeAsync' to 101 to match 'staleTime: 100'

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-05 21:45:37 +09:00
Ciarán Curley
fcaa1d2db4
test(vue-query/infiniteQueryOptions): replace query-core 'QueryClient' import with vue-query proxy (#10385)
tests: use proxy instead of query core

infiniteQueryOptions.test-d.ts for Vue Query was incorrectly using the
bare query client from core instead of the vue proxy query client.

Co-authored-by: Wonsuk Choi <sukvvon@gmail.com>
2026-04-05 21:36:03 +09:00
Wonsuk Choi
80f0370894
test(svelte-query/createQueries): move type tests from 'createQueries.svelte.test.ts' to 'createQueries.test-d.ts' (#10389)
* test(svelte-query/createQueries): move type tests from 'createQueries.svelte.test.ts' to 'createQueries.test-d.ts'

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-05 20:04:27 +09:00
Wonsuk Choi
7781a3e68b
test(svelte-query/createQueries): switch to fake timers, replace 'vi.waitFor' with 'vi.advanceTimersByTimeAsync', and move 'queryClient' to 'beforeEach' (#10388)
* test(svelte-query/createQueries): switch to fake timers, replace 'vi.waitFor' with 'vi.advanceTimersByTimeAsync', and move 'queryClient' to 'beforeEach'

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-05 16:55:34 +09:00
Wonsuk Choi
4b2cd73707
test(svelte-query/createQueries): add test for not fetching queries with different durations when 'isRestoring' is true (#10387) 2026-04-05 16:32:30 +09:00
Wonsuk Choi
422a99758e
test(svelte-query/createQueries): move test files into 'createQueries' directory (#10386) 2026-04-05 15:50:42 +09:00
Ciarán Curley
2e5d9db73d
test(solid-query): rename infinite query options test (#10384)
Co-authored-by: Wonsuk Choi <sukvvon@gmail.com>
2026-04-05 15:44:01 +09:00
Wonsuk Choi
5f5cfabfd4
test(svelte-query/createQueries): add test for not fetching when 'isRestoring' is true (#10382)
* test(svelte-query/createQueries): add test for not fetching when 'isRestoring' is true

* test(svelte-query/createQueries): remove '(isRestoring)' from describe block

* test(svelte-query/createQueries): move 'queryClient' inside 'IsRestoringExample' component
2026-04-05 15:04:44 +09:00
github-actions[bot]
5ca721fb05
ci: Version Packages (#10379) release-2026-04-03-1025 @tanstack/angular-query-experimental@5.96.2 @tanstack/eslint-plugin-query@5.96.2 @tanstack/preact-query-devtools@5.96.2 @tanstack/preact-query-persist-client@5.96.2 @tanstack/preact-query@5.96.2 @tanstack/query-async-storage-persister@5.96.2 @tanstack/query-broadcast-client-experimental@5.96.2 @tanstack/query-core@5.96.2 @tanstack/query-devtools@5.96.2 @tanstack/query-persist-client-core@5.96.2 @tanstack/query-sync-storage-persister@5.96.2 @tanstack/react-query-devtools@5.96.2 @tanstack/react-query-next-experimental@5.96.2 @tanstack/react-query-persist-client@5.96.2 @tanstack/react-query@5.96.2 @tanstack/solid-query-devtools@5.96.2 @tanstack/solid-query-persist-client@5.96.2 @tanstack/solid-query@5.96.2 @tanstack/svelte-query-devtools@6.1.13 @tanstack/svelte-query-persist-client@6.1.13 @tanstack/svelte-query@6.1.13 @tanstack/vue-query-devtools@6.1.13 @tanstack/vue-query@5.96.2
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-03 12:20:46 +02:00
mixelburg
deb62e0028
fix(eslint-plugin): normalize whitespace in allowList variable matching for multiline expressions (#10337)
* fix(eslint-plugin): normalize whitespace in allowList variable matching

When a member expression spans multiple lines (e.g. `ignored\n    .run()`),
`sourceCode.getText()` preserves the newline. The root segment extracted
by splitting on `.'` then becomes `'ignored\n    '`, which never matches
the allowlisted variable name `'ignored'`.

Fix: extend `normalizeChain` to also collapse all whitespace, so
multi-line chains produce the same identifier path as single-line ones.

Fixes #10334

* changeset

---------

Co-authored-by: Maks Pikov <mixelburg@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-04-03 12:02:57 +02:00
Zelys
67b12ae1a0
docs: add polling guide (#10330)
* docs(react): add polling guide

Adds a dedicated guide for refetchInterval-based polling. The option was
only mentioned in passing in important-defaults.md with no explanation of
how it works, how to adapt it dynamically, or how it interacts with window
focus, networkMode, and the enabled flag.

Covers:
- Basic setup and independence from staleTime
- Dynamic intervals via function form
- refetchIntervalInBackground for dashboards / always-on UIs
- Disabling window-focus refetching for fullscreen game and kiosk UIs
- Pausing polling with the enabled flag
- networkMode: 'always' for unreliable navigator.onLine environments
- Deduplication behavior across multiple observers

Updates config.json to add the guide to the React sidebar between
Window Focus Refetching and Disabling/Pausing Queries.
Adds a cross-reference in important-defaults.md.

* docs(react/polling): add example markers for framework portability

* docs(react): fix deduplication note — timers are per observer, not per query

* docs(react): address review feedback on polling guide

- Remove staleTime enumeration; link to Important Defaults instead
- Remove game/kiosk focus management examples (scope creep)
- Rewrite pausing polling to use refetchInterval function instead of enabled: false
- Fix offline support section: connectivity uses online/offline events, not navigator.onLine
- Fix deduplication note: remove queuing implication and em dash
- Add non-browser environments note pointing to React Native guide

* docs(solid,vue): add polling guide framework ports

* docs: wrap React Native section in markers for framework port exclusion

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-01 11:04:45 +02:00
github-actions[bot]
75052a7fd0
ci: Version Packages (#10370) release-2026-04-01-0803 @tanstack/angular-query-experimental@5.96.1 @tanstack/eslint-plugin-query@5.96.1 @tanstack/preact-query-devtools@5.96.1 @tanstack/preact-query-persist-client@5.96.1 @tanstack/preact-query@5.96.1 @tanstack/query-async-storage-persister@5.96.1 @tanstack/query-broadcast-client-experimental@5.96.1 @tanstack/query-core@5.96.1 @tanstack/query-devtools@5.96.1 @tanstack/query-persist-client-core@5.96.1 @tanstack/query-sync-storage-persister@5.96.1 @tanstack/react-query-devtools@5.96.1 @tanstack/react-query-next-experimental@5.96.1 @tanstack/react-query-persist-client@5.96.1 @tanstack/react-query@5.96.1 @tanstack/solid-query-devtools@5.96.1 @tanstack/solid-query-persist-client@5.96.1 @tanstack/solid-query@5.96.1 @tanstack/svelte-query-devtools@6.1.12 @tanstack/svelte-query-persist-client@6.1.12 @tanstack/svelte-query@6.1.12 @tanstack/vue-query-devtools@6.1.12 @tanstack/vue-query@5.96.1
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-01 09:58:40 +02:00
Marc-André Côté
4a3275c15e
fix(build): exclude config files from production DTS rollup (#10358)
* fix(build): exclude config files from production DTS rollup

The `experimentalDts` option in tsup respects the tsconfig `include`
array to determine which files are in scope for DTS generation. Each
package's `tsconfig.json` includes `*.config.*` for IDE support, and
`tsconfig.prod.json` inherited this without overriding it. This caused
`vite.config.ts` and `tsup.config.ts` to be swept into the DTS rollup,
leaking `import { UserConfig } from 'vite'` into published types. Since
vite references `@types/node`, this globally overrides the DOM
`setTimeout` return type from `number` to `NodeJS.Timeout` for all
consumers.

Add `"include": ["src"]` (and `"exclude": ["src/__tests__"]` where
applicable) to all `tsconfig.prod.json` files that were missing it,
matching the pattern already used by query-core, react-query,
preact-query, and solid-query.

* chore: add changeset for DTS type pollution fix

* test(build): add regression test for build tool type leaks in .d.ts files

Adds scripts/verify-dts-imports.ts that scans all published .d.ts files
for forbidden imports from build tools (vite, tsup, vitest) and
`/// <reference types="node" />`. Wired into test:pr and test:ci to
run after the build completes.

* fix(build): fail fast when no .d.ts files found in verify-dts-imports

* chore: add exclude for consistency in react-query-next-experimental

* chore: fix log message to mention both .d.ts and .d.cts files

* ci: apply automated fixes

* chore: remove verify-dts-imports script and related package.json changes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-04-01 09:40:46 +02:00
renovate[bot]
2853bfb07f
chore(deps): lock file maintenance (#10367)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-01 04:03:07 +00:00
Zelys
3fd34606eb
docs(react): clarify staleTime 'static' vs Infinity with 'always' triggers (#10354)
* docs(react): clarify staleTime 'static' vs Infinity with 'always' triggers

* docs(react): lead with invalidateQueries() distinction for staleTime: 'static' vs Infinity
2026-03-31 16:11:02 +02:00
github-actions[bot]
73e783bd86
ci: Version Packages (#10364) release-2026-03-31-1047 @tanstack/angular-query-experimental@5.96.0 @tanstack/eslint-plugin-query@5.96.0 @tanstack/preact-query-devtools@5.96.0 @tanstack/preact-query-persist-client@5.96.0 @tanstack/preact-query@5.96.0 @tanstack/query-async-storage-persister@5.96.0 @tanstack/query-broadcast-client-experimental@5.96.0 @tanstack/query-core@5.96.0 @tanstack/query-devtools@5.96.0 @tanstack/query-persist-client-core@5.96.0 @tanstack/query-sync-storage-persister@5.96.0 @tanstack/react-query-devtools@5.96.0 @tanstack/react-query-next-experimental@5.96.0 @tanstack/react-query-persist-client@5.96.0 @tanstack/react-query@5.96.0 @tanstack/solid-query-devtools@5.96.0 @tanstack/solid-query-persist-client@5.96.0 @tanstack/solid-query@5.96.0 @tanstack/svelte-query-devtools@6.1.11 @tanstack/svelte-query-persist-client@6.1.11 @tanstack/svelte-query@6.1.11 @tanstack/vue-query-devtools@6.1.11 @tanstack/vue-query@5.96.0
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-31 12:42:54 +02:00
Eliya Cohen
ed2f2ab01f
feat(eslint-plugin-query): add prefer-query-options rule (#10359) 2026-03-31 13:12:57 +03:00
Wonsuk Choi
14a97b7ab1
test(react-query): replace 'import React' with 'import * as React' in 'usePrefetchQuery' and 'usePrefetchInfiniteQuery' (#10363) 2026-03-31 15:43:22 +09:00
Wonsuk Choi
fd8c068c94
test({react,preact}-query/useSuspenseQueries): merge redundant second 'describe' block into first (#10362) 2026-03-31 15:19:01 +09:00