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

5,991 commits

Author SHA1 Message Date
Lucas127128
71feb905d8
docs(svelte): more guides (#12478)
* more svelte guide

* Fix examples

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-11-01 16:02:20 +01:00
Maksym Lyskov
05d9b6a40b
fix(query-core): unpause a mutation that can start after its onMutate (#11788)
* fix(query-core): unpause a mutation that can start after its onMutate

Mutation.execute() computes isPaused before it awaits the MutationCache and
mutation onMutate callbacks, and dispatches pending with that value. When the
mutation cannot start at that point (queued behind another mutation in its
scope, or offline) but can by the time onMutate resolves, retryer.start()
runs it directly instead of going through pause(), so no continue action is
dispatched and the mutation reports isPaused: true for its whole request.
defaultShouldDehydrateMutation and resumePausedMutations read that flag, so
the in-flight mutation is dehydrated as not yet sent and runs a second time
after a restore.

Dispatch continue right before start() when the mutation is still marked
paused but can start now, as #9015 does for a restored mutation.

Source: packages/query-core/src/mutation.ts execute(),
packages/query-core/src/retryer.ts start(), hydration.ts
defaultShouldDehydrateMutation.

* test(query-core): use createKey in mutation regression test

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-11-01 15:13:14 +01:00
Wonsuk Choi
2023a563c6
style(examples/angular): remove extra spaces inside the cached posts comment (#12477) 2026-11-01 22:50:28 +09:00
Wonsuk Choi
92c41c0594
refactor(examples/react/nextjs-app-optimistic-updates): type the form submit handlers with 'React.SubmitEvent' instead of the deprecated 'React.FormEvent' (#12095)
* refactor(examples/react/nextjs-app-optimistic-updates): type the form submit handlers with 'React.SubmitEvent' instead of the deprecated 'React.FormEvent'

* chore(examples/react/nextjs-app-optimistic-updates/package.json): raise the '@types/react' minimum to '^19.2.10' for 'React.SubmitEvent'
2026-11-01 22:35:41 +09:00
autofix-ci[bot]
73758917d1
ci: apply automated fixes 2026-11-01 12:51:26 +00:00
Lazizbek Ergashev
e69cac69d9
fix(query-core): handle the rejection of paused refetches in 'refetchQueries' with 'throwOnError' (#12442)
* fix(query-core): handle the rejection of paused refetches in 'refetchQueries' with 'throwOnError'

* refactor(query-core): reuse paused status in refetchQueries

* docs(query-core): clarify paused refetch promise behavior

---------

Co-authored-by: TkDodo <office@dorfmeister.cc>
2026-11-01 13:49:46 +01:00
Lucas127128
e290639106
docs(svelte-query): Add guides (#12454)
* Add svelte guide

* fix issues in examples

* 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>
2026-11-01 13:40:55 +01:00
autofix-ci[bot]
fbfe33829a
ci: apply automated fixes 2026-11-01 12:12:10 +00:00
JSap0914
2ee2fd935a
fix(query-core): addToEnd caps result to max when items already exceeds max (#10969)
* fix(query-core): addToEnd caps result to max when items already exceeds max

addToEnd(items, item, max) used slice(1) which only ever removed one
element. When items.length > max (e.g. maxPages reduced at runtime),
the returned array could still exceed max.

Replace slice(1) with slice(-max) so the result is always the last
max elements of the extended array, regardless of input length.

* fix(query-core): cap prepended items to max

---------

Co-authored-by: JSap0914 <JSap0914@users.noreply.github.com>
Co-authored-by: TkDodo <office@dorfmeister.cc>
2026-11-01 13:10:27 +01:00
recallhyx
f2215d2594
fix(query-core): use '() => void' instead of DOM-only 'VoidFunction' (#12447)
* fix(query-core): use '() => void' instead of DOM-only 'VoidFunction'

* Delete .changeset/query-core-no-dom-void-function.md

* Revert "Delete .changeset/query-core-no-dom-void-function.md"

This reverts commit c28e10965b.

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-11-01 12:55:56 +01:00
Yeongbin Jeong
89d0a1f564
docs(react-query): document re-render behavior during polling (#12433)
* docs(react-query): document re-render behavior during polling

* 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>
2026-11-01 12:46:34 +01:00
Frank Johnston
86e79571fd
fix(query-core): shallowEqualObjects ignores key-set differences when counts match (#10777)
* fix(query-core): shallowEqualObjects ignores key-set differences when counts match

`shallowEqualObjects` only iterated the keys of `a` and compared `a[key] !== b[key]`.
When both objects have the same number of keys but different key names, a key
present on `a` but absent on `b` reads as `undefined` on `b`; if the corresponding
value on `a` is also `undefined` (or otherwise equal), the function incorrectly
reported the objects as equal. This breaks the documented "shallow compare objects"
contract and can suppress an `observerOptionsUpdated` notification when an observer's
defaulted options swap one key for another between renders.

Fix: require each key of `a` to be an own-property of `b` before comparing values.

* fix(query-core): ignore inherited properties in shallow equality

* test(query-core): use toBe for shallow equality assertions

---------

Co-authored-by: safechem <sales@alphachemicals.ie>
Co-authored-by: TkDodo <office@dorfmeister.cc>
2026-11-01 12:31:11 +01:00
Wonsuk Choi
9b52414c1b
chore(integrations): group by adapter and rename packages to '@tanstack/query-integration-<adapter>-<name>' to match examples (#12475) 2026-11-01 20:19:41 +09:00
Lazizbek Ergashev
1e1caa5a32
fix({react,preact}-query): set the observer options before subscribing (#12230)
* fix(react-query): set the observer options before subscribing so revealing an 'Activity' does not fetch the previous key

* fix(preact-query): set the observer options before subscribing

* test(react-query): cover Activity reveal for all query hooks

Port vkpdeveloper's Activity regression tests from TanStack/query#12283.

* test(react-query): use createKey in Activity coverage

* test: update Activity regressions for current helpers and lint rules

---------

Co-authored-by: TkDodo <office@dorfmeister.cc>
2026-11-01 12:12:24 +01:00
Wonsuk Choi
ada1f13f0a
chore(examples/vue/simple-nuxt3/.gitignore): align with the Nuxt starter template to ignore '.data', '.nitro' and '.cache' (#12474) 2026-11-01 19:47:25 +09:00
Wonsuk Choi
14ac12ed63
docs(examples): add router and framework suffix to example directories to match their 'package.json' names (#12473)
* docs(examples): add router and framework suffix to example directories to match their 'package.json' names

* docs(svelte): update example links to the renamed 'basic-sveltekit' and 'ssr-sveltekit' directories
2026-11-01 19:39:04 +09:00
github-actions[bot]
a6be1cede9
ci: Version Packages (#12391) release-2026-11-01-1008 @tanstack/query-devtools@5.105.1 @tanstack/query-async-storage-persister@5.105.1 @tanstack/react-query-persist-client@5.105.1 @tanstack/query-core@5.105.1 @tanstack/preact-query-persist-client@5.105.1 @tanstack/preact-query@5.105.1 @tanstack/react-query-next-experimental@5.105.1 @tanstack/angular-query-experimental@5.105.1 @tanstack/query-broadcast-client-experimental@5.105.1 @tanstack/svelte-query-devtools@6.3.7 @tanstack/preact-query-devtools@5.105.1 @tanstack/solid-query-persist-client@5.105.1 @tanstack/svelte-query-persist-client@6.3.7 @tanstack/lit-query@0.2.32 @tanstack/react-query@5.105.1 @tanstack/react-query-devtools@5.105.1 @tanstack/solid-query-devtools@5.105.1 @tanstack/solid-query@5.105.1 @tanstack/vue-query-devtools@6.3.7 @tanstack/query-persist-client-core@5.105.1 @tanstack/vue-query@5.105.1 @tanstack/svelte-query@6.3.7 @tanstack/query-sync-storage-persister@5.105.1 @tanstack/eslint-plugin-query@5.105.1
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-01 11:04:19 +01:00
Wonsuk Choi
ff6c93b7dd
chore(examples): unpin 'nuxt' and remove the 'seroval' overrides now that 'seroval' versions with provenance are available (#12467) 2026-11-01 10:48:35 +09:00
VGontier
8be136b022
fix(query-persist-client-core): discard malformed persisted queries (#11919)
* fix(query-persist-client-core): handle nullish persisted query state

* fix(query-persist-client-core): validate deserialized queries

* fix(query-persist-client-core): validate persisted query fields

* fix(query-persist-client-core): narrow persisted entry validation

---------

Co-authored-by: Vivien Gontier <vivien.gontier@paygreen.fr>
Co-authored-by: Ciarán Curley <ciaran.curley.11.11@gmail.com>
2026-10-31 15:43:35 +00:00
Wonsuk Choi
d88ba6ec46
docs(lit): remove '@tanstack/query-core' and 'lit' from the install commands to install only '@tanstack/lit-query' (#12209)
* docs(lit): remove '@tanstack/query-core' from the install commands since 'lit-query' already depends on it

* docs(lit): remove 'lit' from the install commands since apps using Lit Query already have it
2026-11-01 00:39:26 +09:00
Wonsuk Choi
5c5c11c6e7
fix(lit-query/package.json): remove '@tanstack/query-core' from 'peerDependencies' and move 'lit' to 'devDependencies' (#12189)
* fix(lit-query/package.json): remove '@tanstack/query-core' from 'peerDependencies' since it is already a dependency

* docs(lit): restore the install commands to move them to a separate change

* fix(lit-query/package.json): move 'lit' from 'dependencies' to 'devDependencies' so it is declared only as a peer dependency
2026-11-01 00:38:03 +09:00
Wonsuk Choi
9be2e7049c
test({solid-query,solid-query-persist-client,svelte-query}): access query and mutation results through their object instead of destructuring them (#12464)
* test(solid-query): access query and mutation results through their object instead of destructuring them

* test(svelte-query): access query results through their object instead of destructuring them

* test(svelte-query/createInfiniteQuery): access the error booleans through the query object instead of destructuring them

* test(solid-query-persist-client/PersistQueryClientProvider): access the 'useQueries' result by index instead of destructuring it
2026-10-31 23:57:19 +09:00
Wonsuk Choi
979695d0a2
docs({react,preact,angular,solid,svelte,vue}-query): describe when the 'Defined' and 'Undefined' 'initialData' overloads are selected (#12460)
* docs({react,preact,angular,solid,svelte,vue}-query): describe the 'initialData' overloads as 'known to be defined' and 'omitted or may be undefined'

* docs({react,preact,angular,solid,svelte,vue}-query): regenerate reference docs

* docs({react,preact,angular,solid,svelte,vue}-query): mention an 'initialData' function that may return 'undefined' in the 'Undefined' overload descriptions

* docs({react,preact,angular,solid,svelte,vue}-query): regenerate reference docs
2026-10-30 16:41:25 +09:00
Wonsuk Choi
69fcbad72b
fix(examples/vue/algolia): replace recursive 'Hit' type to avoid excessively deep type instantiation in 'useInfiniteQuery' (#12461) 2026-10-30 10:38:45 +09:00
Wonsuk Choi
7ccba6e959
fix({react,preact,angular,solid,vue}-query/infiniteQueryOptions): correct the overload selected for a possibly-undefined 'initialData' (#11373)
* fix({react,preact,angular}-query): remove erroneous '| undefined' from 'DefinedInitialDataInfiniteOptions'

* test({react,preact,angular}-query/infiniteQueryOptions): use a non-literal condition for the ternary 'initialData' test

* fix({solid,vue}-query): accept a possibly-undefined 'initialData' in 'UndefinedInitialDataInfiniteOptions'

* fix(vue-query/infiniteQueryOptions): declare the 'Defined' overload first so a defined 'initialData' still selects it

* docs({react,preact,angular,solid,vue}-query): drop generated reference doc changes, regenerated by autofix after merge

* chore(.changeset): align the message with the PR title

* docs({react,preact,angular,solid,vue}-query/infiniteQueryOptions): describe overload selection by whether 'initialData' is known to be defined

* docs(framework/*/reference): regenerate reference docs

* docs(framework): restore the generated reference docs from main and leave them to autofix

* docs({react,preact,angular,solid,vue}-query): regenerate reference docs

* test({react,preact,angular,solid,vue}-query/infiniteQueryOptions): start test titles with 'should'
2026-10-30 10:06:32 +09:00
Wonsuk Choi
b9f369a23a
fix(solid-query/{queryOptions,useQuery}): correct the overload selected for 'initialData' (#11595)
* fix(solid-query/{queryOptions,useQuery}): correct the overload selected for 'initialData'

* ci: apply automated fixes

* docs(framework/*/reference): regenerate reference docs

* ci: apply automated fixes

* test(solid-query/queryOptions): assert the 'useQuery' data type when 'initialData' may be undefined

* docs(solid-query): regenerate reference docs

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-10-30 09:58:02 +09:00
Wonsuk Choi
c9c00015ef
docs(examples): add router and framework suffix to 'docs/config.json' labels and 'package.json' names (#12458)
* docs(examples): add router and framework suffix to 'docs/config.json' labels and 'package.json' names

* docs(examples): distinguish Next.js App/Pages Router and Nuxt/SolidStart major versions in example labels and names
2026-10-30 01:50:34 +09:00
Wonsuk Choi
007127748a
fix(examples/{react,preact}/auto-refetching): encode 'add' query parameter with 'encodeURIComponent' (#12457) 2026-10-30 01:23:06 +09:00
Wonsuk Choi
127cbf9922
docs(examples/lit): add 'auto-refetching', 'infinite-query-with-max-pages', 'load-more-infinite-scroll', 'optimistic-updates' and 'prefetching' examples (#12456)
* docs(examples/lit): add 'auto-refetching', 'infinite-query-with-max-pages', 'load-more-infinite-scroll', 'optimistic-updates' and 'prefetching' examples

* fix(examples/lit/auto-refetching): encode 'add' query parameter with 'encodeURIComponent'
2026-10-30 01:04:56 +09:00
Wonsuk Choi
8de245ba16
docs(examples/lit): add 'batching' and 'offline' examples (#12455) 2026-10-30 00:14:24 +09:00
Wonsuk Choi
af78ace5c4
docs(examples/lit): add 'star-wars' and 'rick-morty' examples with '@lit-labs/router' (#12453) 2026-10-29 19:27:22 +09:00
Wonsuk Choi
744cb2cb2e
docs(examples/lit): add 'simple', 'basic-graphql-request', 'default-query-function', 'playground', 'algolia' and 'chat' examples (#12451) 2026-10-29 17:27:14 +09:00
Wonsuk Choi
1fa2f1bba1
chore(oxlint.config): add 'vueConfig' with native 'vue' rules for 'vue-query' and 'vue-query-devtools' (#12450) 2026-10-29 15:25:01 +09:00
Wonsuk Choi
7b73668a61
chore(examples/vue): add 'eslint-plugin-vue' and 'eslint-config-prettier' to all examples and '@nuxt/eslint' to Nuxt examples (#12449)
* chore(examples/vue): add 'eslint-plugin-vue' and 'eslint-config-prettier' to all examples and '@nuxt/eslint' to Nuxt examples

* refactor(examples/vue): rename single-word components and hyphenate template attributes and events
2026-10-29 15:16:37 +09:00
Wonsuk Choi
52d7fd34a5
docs(examples/vue): replace 'nuxt3' with 'simple-nuxt3' and 'simple-nuxt4' examples and include them in the workspace (#12448) 2026-10-29 14:06:04 +09:00
Wonsuk Choi
259de1d810
chore(deps): update 'vite' to '^8.3.5', deduplicate 'pnpm-lock.yaml' and remove 'vite@6.4.1' from 'trustPolicyExclude' (#12446) 2026-10-29 12:48:15 +09:00
Wonsuk Choi
fdb7692e83
docs(examples/vue): add 'pagination', 'auto-refetching', 'load-more-infinite-scroll', 'infinite-query-with-max-pages', 'prefetching' and 'optimistic-updates' examples with Nuxt (#12445) 2026-10-29 12:08:10 +09:00
Wonsuk Choi
ff41bb21c6
docs(examples/vue): add 'suspense', 'batching' and 'offline' examples (#12444) 2026-10-29 11:38:33 +09:00
Wonsuk Choi
5aa553880a
docs(examples/vue): add 'star-wars', 'rick-morty' and 'vue-router' examples (#12439) 2026-10-29 10:25:46 +09:00
Wonsuk Choi
e423d30ae0
docs(examples/vue): add 'basic-graphql-request', 'default-query-function', 'devtools-panel', 'playground', 'shadow-dom', 'algolia' and 'chat' examples (#12438) 2026-10-28 19:18:28 +09:00
Wonsuk Choi
ec7bcd4ed1
fix(examples/chat): pass the query 'signal' to 'streamFn' so refetching cancels the previous stream (#12437) 2026-10-28 17:22:17 +09:00
Wonsuk Choi
9d61f1e43e
fix(examples): remove horizontal overflow in 'shadow-dom' and make character selection keyboard accessible in 'prefetching' (#12436) 2026-10-28 17:10:27 +09:00
Wonsuk Choi
3185bcf97c
fix(examples): validate ids, handle HTTP and loader errors, and show watchers and unknown locations correctly (#12435)
* fix(examples): validate ids, handle HTTP and loader errors, and show watchers and unknown locations correctly

* fix(examples/{batching,prefetching}): disable loading while input is invalid and reject non-decimal character ids
2026-10-28 16:56:52 +09:00
Wonsuk Choi
5f37e7cb6b
refactor(svelte): declare '$props()' with 'let' and type them with 'Props', 'LayoutProps' and 'PageProps' in examples and tests (#12434)
* refactor(examples/svelte): declare '$props()' with 'let' and type them with 'Props', 'LayoutProps' and 'PageProps'

* test(svelte-query,svelte-query-persist-client): declare '$props()' with 'let' and type them with 'Props'

* refactor(svelte-query/HydrationBoundary): declare '$props()' with 'let'
2026-10-28 16:06:44 +09:00
Wonsuk Choi
b2ed952200
docs(examples/svelte): add 'pagination', 'prefetching' and 'infinite-query-with-max-pages' examples (#12432) 2026-10-28 15:35:46 +09:00
Wonsuk Choi
2a7e3cc5e0
docs(examples/svelte): add 'batching' and 'offline' examples (#12431) 2026-10-28 14:51:48 +09:00
Wonsuk Choi
e8770f5d21
docs(examples/svelte): add 'rick-morty' and 'sveltekit' examples (#12430) 2026-10-28 13:57:37 +09:00
Wonsuk Choi
9d1e2de1d7
docs(examples/svelte): add 'basic-graphql-request', 'default-query-function', 'shadow-dom', 'algolia' and 'chat' examples (#12429)
* docs(examples/svelte): add 'basic-graphql-request', 'default-query-function', 'shadow-dom', 'algolia' and 'chat' examples

* docs(examples/svelte): declare '$props()' with 'let' in the new examples

* docs(examples/svelte/{basic-graphql-request,default-query-function}): prevent the hash navigation on the post links
2026-10-28 13:27:02 +09:00
Wonsuk Choi
158a5868cd
docs(examples/solid): add 'pagination', 'auto-refetching', 'prefetching' and 'optimistic-updates' examples with SolidStart (#12428)
* docs(examples/solid): add 'pagination', 'auto-refetching', 'prefetching' and 'optimistic-updates' examples with SolidStart

* docs(examples/solid/{pagination,optimistic-updates}): keep query errors inside the 'ErrorBoundary'
2026-10-28 12:16:21 +09:00
Wonsuk Choi
2d5e6fcfc5
docs(solid): remove the leftover 'suspense' function and option mentions from the 'suspense' guide and quick start (#12427) 2026-10-28 11:05:13 +09:00