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

5,038 commits

Author SHA1 Message Date
Wonsuk Choi
c9dba0736c
test(query-broadcast-client-experimental): replace inline query key literals with 'queryKey' in incoming message tests (#11247) 2026-08-22 10:48:36 +09:00
Dominik Dorfmeister 🔮
d156adcc15
test: transition tests (#11246)
* test: transition tests

* Apply suggestions from code review

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-21 21:08:04 +02:00
Dominik Dorfmeister 🔮
37127dbe47
fix/11018 (#11245)
* revert: remove NoInfer from useQuery return types

* add union type tests

* changeset
2026-08-21 16:22:28 +02:00
한국
6796c51275
fix(broadcast-client): recover from errors thrown while applying an incoming cross-tab message (#11242)
* fix(broadcast-client): recover from errors thrown while applying an incoming cross-tab message

If applying an incoming cross-tab message (query.setState/queryCache.build,
which notifies observers) throws, the internal `tx()` helper's `transaction`
flag was never reset. This silently disabled all future outgoing broadcasts
from this tab for the rest of the session. Guard with try/finally so a single
failed message can't permanently break cross-tab sync.

* test(broadcast-client): also cover the query.setState throw path

The existing regression test only exercised queryCache.build (a brand-new
remote query hash). Add a case where the incoming message targets an
existing query, so an exception during query.setState is exercised too.

Addresses CodeRabbit review feedback on #11242.
2026-08-21 11:50:13 +02:00
Wonsuk Choi
2fbe04e492
test(query-broadcast-client-experimental): replace inline 'new Promise' timeouts with 'sleep' from 'query-test-utils' (#11241) 2026-08-21 13:56:29 +09:00
Wonsuk Choi
bec1f1b286
test(query-broadcast-client-experimental): replace inline query key literals with 'queryKey' from 'query-test-utils' (#11240) 2026-08-21 13:47:08 +09:00
Zane Wang
3e83601003
fix(query-core): memoize falsy combine results in QueriesObserver (#11065)
fix(query-core): memoize falsy combine results

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-20 19:04:49 +02:00
Ciarán Curley
e6748265c8
React: update usePrefetchQuery to use new methods, plus react adaptor tests and docs (#10668)
* feat(react-query): update usePrefetchQuery to use new imperitive methods plus tests

* docs(react-query): new docs for usePrefetchQuery

* Update .changeset/warm-candies-like.md

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

* Update packages/react-query/src/usePrefetchInfiniteQuery.tsx

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

* Update packages/react-query/src/usePrefetchQuery.tsx

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

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-20 18:35:32 +02:00
Ciarán Curley
4e48c581b7
Preact: update usePrefetchQuery to use new methods with docs (#10669)
* feat(preact-query): use new methods for usePrefetchQuery plus tests

* docs(preact-query): updated docs for usePrefetchQuery

* Update docs/framework/preact/reference/interfaces/UsePrefetchInfiniteQueryOptions.md

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

* Update packages/preact-query/src/usePrefetchInfiniteQuery.tsx

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

* Update packages/preact-query/src/usePrefetchQuery.tsx

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

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-20 18:35:10 +02:00
Kushida
88342670ec
fix(react-query): keep unsubscribed useQueries idle (#11130) 2026-08-20 17:32:09 +02:00
Ciarán Curley
97ce30b51e
Vue: add new impertive methods to vue proxy QueryClient (#11208)
* feat(vue-query): add new methods to vue-query

* docs(vue-query): docs for new impertive methods for Vue

* fix(vue-query): remove getter options from impertive methods

There is no evidence that the () => queryOptions getter type is
properly used by `fetchQuery` et al, as while it accepts a getter in the
types, it doens't resolve the function at runtime (as opposed to
`useQuery`). Removing the type from `query` and `fetchQuery` and
documenting calling getters impertivly as a workaround.

* Update packages/vue-query/src/queryClient.ts

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

* Update packages/vue-query/src/usePrefetchQuery.ts

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

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-20 17:12:42 +02:00
Dominik Dorfmeister 🔮
1ef42087c9
ref: remove experimental_prefetchInRender (#11221) 2026-08-20 11:32:10 +02:00
Dominik Dorfmeister 🔮
bf7ae20fed
docs(example): batching (#11008)
* docs(example): dataloader

* use tanstack pacer instead of dataloader

* add staleTime

* switch to useAsyncBatchedCallback

* Revert "switch to useAsyncBatchedCallback"

This reverts commit 4d408daa63.

* fix: use PromiseWithResolvers

* add batching example to docs
2026-08-20 11:25:31 +02:00
rejifald
ee4c7c2be3
docs: add StitchAPI to community resources (#11025)
* docs: add StitchAPI to community resources

* docs: reframe StitchAPI entry as a queryFn complement, not a competitor
2026-08-20 11:13:07 +02:00
Jooyoung Shin
4913802895
fix(preact-query): allow retryOnMount when throwOnError is function (#11166)
Ports #9338 to preact-query: ensurePreventErrorBoundaryRetry now
receives the cached query and evaluates a function-form throwOnError
against the actual error before setting retryOnMount = false, instead
of treating any function as truthy. Includes the regression tests
from #9338, two of which fail on current main.

Fixes #11165

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-20 11:07:35 +02:00
n-satoshi061
3c79861ab1
fix(broadcast-client): handle unhandled postMessage rejections (#10771)
* fix(broadcast-client): handle unhandled postMessage rejections

Wrap channel.postMessage() calls in safePost() to catch DataCloneError
and similar failures that occur when query data contains non-cloneable
values (ReadableStream, Response, Vue reactive proxies, etc.).

Adds an optional onBroadcastError callback to BroadcastQueryClientOptions
so consumers can pipe errors to Sentry/Datadog. Falls back to console.warn
in development when the callback is not provided.

Fixes #10543

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(broadcast-client): guard against throwing onBroadcastError callback

Wrap onBroadcastError() in a try/catch so that if the callback itself
throws, the error does not escape as an unhandled rejection. Falls back
to console.warn in development when the callback throws.

Add a test asserting no unhandledRejection fires when onBroadcastError throws.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(broadcast-client): handle async onBroadcastError rejections

Support async onBroadcastError callbacks by calling .catch() on the
returned Promise, preventing unhandled rejections when the callback
rejects asynchronously.

Also extracts the console.warn fallback into warnBroadcastError to
deduplicate the warning logic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(broadcast-client): use try/finally to ensure unhandledRejection listener cleanup

Prevents listener leaks into subsequent tests if an assertion throws
before process.off() is reached.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(broadcast-client): improve types, messages, and docs

- Export BroadcastErrorEvent interface with QueryKey typing so consumers
  can import the type directly
- Use discriminated union for internal BroadcastMessage (state only on
  updated) for more precise typing
- onBroadcastError now receives BroadcastErrorEvent (no internal state
  field) instead of the raw BroadcastMessage
- Differentiate dev warning messages: broadcast failures explain the
  structured-clone cause and consequence; onBroadcastError failures
  explicitly identify the hook as the source
- Remove warnBroadcastError helper in favour of context-specific inlined
  warn calls
- Fix duplicate queryClient.getQueryCache() call (use queryCache directly)
- Add JSDoc to all BroadcastQueryClientOptions fields
- Add onBroadcastError section to broadcastQueryClient docs with Sentry
  example

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(broadcast-client): assert warn message when onBroadcastError throws or rejects

Add two tests that verify the '[broadcastQueryClient] onBroadcastError
threw while handling...' console.warn message is emitted in development
when the onBroadcastError callback itself throws synchronously or rejects
asynchronously.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(broadcast-client): include state in 'added' broadcasts

The receiver's onmessage handler reads state for 'added' events to call
query.setState(state) and queryCache.build(..., state), but the sender
was not including state in the outbound message. This caused receiving
tabs to apply undefined state for newly added queries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(broadcast-client): wrap warnSpy in try/finally to prevent spy leakage

If an assertion fails before mockRestore(), the console.warn spy would
leak into subsequent tests. Wrapping each spy block in try/finally
ensures restore always runs regardless of test outcome.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: apply automated fixes

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-20 10:24:33 +02:00
Scott Cooper
9656dc4e5f
fix(query-core): Keep observer notifications stable (#11234)
Removing an observer in place can shift the active notification loop and skip the next observer. Iterate over a shallow copy so synchronous unsubscriptions keep the old behavior without giving up the faster removal path from #11214.

Co-authored-by: Codex <noreply@openai.com>
2026-08-20 10:18:58 +02:00
Wonsuk Choi
3132285a04
chore(nx.json): drop dead 'dist-cjs' build output entry (#11235) 2026-08-20 16:09:40 +09:00
Wonsuk Choi
5e1b866504
test(lit-query): replace inline 'new Promise' timeouts with 'sleep' from 'query-test-utils' (#11104)
* test(lit-query): replace inline 'new Promise' timeouts with 'sleep' from 'query-test-utils'

* test(lit-query): replace inline 'new Promise' timeout with 'sleep' in 'testHost.ts'

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-20 09:44:52 +09:00
Wonsuk Choi
64a8035303
fix(lit-query): migrate to standard tsdown build so 'build' output is cached by nx and 'test:build' passes (#10943)
* fix(lit-query): migrate to standard tsup build so 'build' output is cached by nx and 'test:build' passes

* chore(lit-query): align 'package.json' and rename 'vitest.config.ts' to 'vite.config.ts' to match react-query, drop obsolete knip 'src/tests' ignore

* fix(lit-query): migrate build from 'tsup' to 'tsdown' to match other adapters

* docs(.changeset): update 'lit-query' changeset to reference 'tsdown' instead of 'tsup'
2026-08-20 09:34:13 +09:00
Dominik Dorfmeister 🔮
b866a95add
ref: remove unused experimental_beforeQuery and experimental_afterQuery (#11233) 2026-08-19 20:34:40 +02:00
Lucas127128
b8e35598ef
docs(svelte-query/quick-start): Add quick start docs (#11227)
* Add quick start docs in svelte query

* Apply suggestions from code review

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

* 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-08-18 21:21:21 +02:00
Dominik Dorfmeister 🔮
fb6c3fabda
fix(react): switch to export type * (#11228) 2026-08-18 21:20:11 +02:00
Shahid Hassan Ansari
5981771abe
fix(query-core): release the retryer once a mutation settles (#11218)
* fix(query-core): release the retryer once a mutation settles

Mutation.execute() never cleared #retryer after settling, so the settled
retryer's promise kept that mutation's result, variables and context
reachable for as long as the MutationCache retained the Mutation. Mirror
the treatment Query.fetch() received in #11163, guarded by an identity
check so a mutation re-executed from a cache callback keeps its own
retryer.

Releasing the retryer alone would change continue(): a settled mutation
no longer has a retryer to continue, so it would fall through to
execute() and run the mutationFn a second time. Both internal callers
filter on state.isPaused and never reach a settled mutation, but
continue() is reachable directly, so the fallback is now gated on the
mutation still being pending -- the same condition execute() already uses
to detect a restored mutation.

Fixes #11216

* test(query-core): assert the settled retryer is actually released

The previous tests only guarded the continue() gating and passed on main
too, so they did not demonstrate the fix. continue() is the only reader
of #retryer outside execute(): while a settled retryer is still held it
hands back that retryer's promise, which resolves with the raw result it
closed over (or rejects with its error). Both new tests fail on main and
pass with the retryer released.

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-18 20:59:40 +02:00
Scott Cooper
1f631b3604
perf(query-core): Skip unused query result tracking (#11225)
* perf(query-core): Skip unused query result tracking

QueriesObserver was building tracked results on every update even when there was no combine function to consume them. Skip that work for normal useQueries notifications.

Co-Authored-By: Codex <noreply@openai.com>

* ref(query-core): Reuse combine skip check

Treat a missing combine function as another reason to skip combining. This keeps the notification flow close to the existing code and only defers result tracking.

Co-Authored-By: Codex <noreply@openai.com>

* ref(query-core): Match combine presence check

Use the same truthiness check as combineResult so null and other falsy runtime values follow the existing no-combine behavior.

Co-Authored-By: Codex <noreply@openai.com>

---------

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-18 18:52:50 +02:00
Dominik Dorfmeister 🔮
294d4e62c4
fix: declaration emit (#11224)
Co-Authored by @artemxknpv
2026-08-18 17:48:33 +02:00
Ben Younes
5199f0884c
fix(vue-query): preserve TQueryKey inference with generic params (#8199) (#10584)
* fix(vue-query): preserve TQueryKey inference with generic params (#8199)

The mapped UseQueryOptions type wrapped queryKey in
MaybeRefDeep<DeepUnwrapRef<TQueryKey>>. The recursive DeepUnwrapRef on a
generic TQueryKey is opaque to TS's homomorphic mapped type inference,
so TQueryKey collapsed to its default (QueryKey) when useQuery was
called from a composable that propagates a generic into the queryKey.

For the queryKey property only, drop DeepUnwrapRef and use a single-
level MaybeRef<TQueryKey> wrap. Inference now binds TQueryKey to the
supplied queryKey shape; queryFn still receives DeepUnwrapRef<TQueryKey>
via the existing mapping for non-queryKey properties.

Co-Authored-By: Ora Studio <noreply@oratelecom.net>

* test(vue-query): strengthen #8199 regression assertion with explicit TData

Per CodeRabbit feedback: bare assertType(useBasket('fruit')) only verified
the call compiled, which would still pass under the old buggy behavior
(TQueryKey collapsing to QueryKey, TData inferred as unknown). Lock the
regression by asserting the propagated TData explicitly.

---------

Co-authored-by: Ora Studio <noreply@oratelecom.net>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-18 17:44:01 +02:00
Dominik Dorfmeister 🔮
de8218cd1d
chore: react-nodenext integration test (#11223)
* chore: react-nodenext integration test

* fix: nx
2026-08-18 16:17:06 +02:00
Dominik Dorfmeister 🔮
267154cf6b
chore: tsup -> tsdown (#11222)
* chore: tsup -> tsdown

* revert size-limit and fix the build instead

* fix angular and devtools build

* fix nextJs builds

* more solid related things

* fix: import order
2026-08-18 15:19:43 +02:00
hamed-bavar
34f7ceed09
fix(query-core): clear stale select error when observer switches to a query without data (#11161)
* fix(query-core): clear stale select error when observer switches to a query without data

* fix(query-core): reset isPlaceholderData on select-error results

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-18 10:55:02 +02:00
Lazizbek Ergashev
cb6c9d3725
fix({react,preact}-query): default 'TData' of infinite query options to 'InfiniteData' (#11147)
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-18 10:51:47 +02:00
Reza Rahemtola
e546d03bef
fix(react-query): remove placeholderData from suspense infinite query (#11144)
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-18 10:44:27 +02:00
Alexander Kireyev
ba4650c05e
fix(query-core): reset isPlaceholderData when select throws on placeholder data (#11011)
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-18 10:44:05 +02:00
Lazizbek Ergashev
18c1c1ef94
fix(query-core): reattach 'MutationObserver' to its mutation in 'onSubscribe' (#11172)
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-18 10:18:59 +02:00
Zelys
6e3d521fe5
fix(types): propagate generic type params to useMutationState select callback (#10373)
* fix(types): propagate generic type params to useMutationState select callback

When TResult is a typed MutationState, the select callback parameter
now receives the correctly typed Mutation instead of the base Mutation type.

Adds a second type param TMutation (defaulting to MutationTypeFromResult<TResult>)
to MutationStateOptions across all five framework adapters. Uses a non-distributive
conditional type to avoid union expansion when TResult is unresolved.

Fixes #9825

* ci: apply automated fixes

* refactor(types): simplify useMutationState cast to mutation as TMutation

Replace the double-cast `(fn as unknown as (m: Mutation) => TResult)(m)`
with the direct `fn(m as TMutation)` across all five framework packages.

The constraint `TMutation extends Mutation<any, any, any, any>` creates
sufficient overlap for the single cast to compile cleanly on TS 5.4–6.0.

* fix(test): reorder imports in useMutationState.test-d.tsx per import/order rule

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(svelte-query): eliminate duplicate MutationTypeFromResult definition

Export MutationTypeFromResult from types.ts so useMutationState.svelte.ts
can import it instead of redefining it. Also normalises the else branch to
plain Mutation, matching every other adapter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-18 10:02:05 +02:00
Guilherme Rabelo
baa256c0d2
docs(examples): add Next.js App Router optimistic updates example (#10997)
* feat(examples): add Next.js App Router optimistic updates example

* refactor(examples/nextjs-app-optimistic-updates): apply post-review corrections

* refactor(examples/nextjs-app-optimistic-updates): apply post-review corrections

* update deps

* ref: remove other optimistic update examples

* ci: apply automated fixes

---------

Co-authored-by: Guilherme Rabelo <T0006742@randon.com.br>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-18 09:57:04 +02:00
Scott Cooper
5bb089d153
perf(query-core): Reduce observer removal overhead (#11214)
Removing observers copied the full observer list on every unsubscribe, which got expensive when thousands of components shared a query. Splice the existing list in place instead.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-18 09:38:08 +02:00
Gihyeon Jeong / 정기현
8582702152
refactor(eslint-plugin-query): remove unused ast-utils helpers (#11115)
* refactor(eslint-plugin-query): remove unused ast-utils helpers

Remove five unused helpers from the ASTUtils object in ast-utils.ts:
getNestedIdentifiers, getNestedReturnStatements, getClosestVariableDeclarator,
mapKeyNodeToText and mapKeyNodeToBaseText.

None are referenced by any rule or other module, and ASTUtils is not part of
the package's public API (it is not exported from index.ts). knip does not flag
them because ASTUtils is exported as a single object, so member-level dead code
slips past it.

All 1709 tests pass and ast-utils.ts line coverage rises from 41% to 95%.

* chore: add changeset for unused ast-utils helper removal

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-18 09:37:41 +02:00
Scott Cooper
01a02bfad3
perf(query-core): Deduplicate tracked query properties (#11215)
* perf(query-core): Deduplicate tracked query properties

Each accessed useQueries result fans the same property out to every observer, making ordinary result mapping quadratic.

Track which properties have already been synchronized during the current result pass. This keeps the #7000 behavior while dropping the 10,000-result tracking benchmark from about 699 ms to under 1 ms locally.

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* test(query-core): Cover repeated property tracking

Extend the existing tracking assertion to cover the same property being read from a second result.

Co-Authored-By: OpenAI Codex <noreply@openai.com>

---------

Co-authored-by: OpenAI Codex <noreply@openai.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-18 09:37:33 +02:00
palkim
47d49d31aa
fix(solid-query): resolve query client outside memos (#10571)
* fix(solid-query): resolve query client outside memos

* fix(solid-query): resubscribe client counters

* test(solid-query): assert client subscription cleanup

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-18 09:22:07 +02:00
Dominik Dorfmeister 🔮
279bb5508b
chore: update to ts 7 and move cut-off to 5.6 (#11212)
* update to ts 7 and move cut-off to 5.7

* changeset

* fix: use typescript v6 with tsup

* ci: apply automated fixes

* ref: update sveltejs/package

* ref: make ts6 the default typescript

* fix: lit build

* effing tsup

* move ignoreDeprecations to solid tsup config

* move ignoreDeprecations to relevant tsup configs

* better lit fix

* restore vue queryClient

* Revert "restore vue queryClient"

This reverts commit 4f95fc918a.

* fix things

* ignore devDep ordering

* vue needs to use ts6

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-17 22:50:18 +02:00
Dominik Dorfmeister 🔮
dce04b5c5a
chore: Add AI guidelines to contribution guide (#11213) 2026-08-17 20:14:36 +02:00
Abdul Wasay
3bc8edfa01
fix(eslint-plugin-query): avoid prototype property false-positives in no-unstable-deps (#11188)
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-17 19:49:57 +02:00
Lazizbek Ergashev
5633820181
fix(lit-query): add DataTag to the queryKey returned by infiniteQueryOptions (#11146)
* fix(lit-query): add DataTag to the queryKey returned by infiniteQueryOptions

* test(lit-query): cover error brand and callback updater for infiniteQueryOptions

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-17 14:54:22 +02:00
Shelley Vohr
4a9bef6cf1
fix(query-core): release the retryer once a fetch settles (#11163)
A query kept its last retryer for life, and the settled promise holds that
fetch's raw result: a second full copy of the data once a refetch has been
structurally shared into state.data, and still held after reset() or removal.

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-17 14:45:44 +02:00
Manan Telrandhe
6613753cbe
docs(examples): use webpack in Next.js examples for StackBlitz compatibility (#11110) 2026-08-17 14:44:53 +02:00
Dominik Dorfmeister 🔮
326aaf1333
fix(query-core): resetQueries now preserves the queries matched before query.reset() changes their state. (#11211)
fix: resetQueries
2026-08-17 14:28:17 +02:00
Ciarán Curley
c6fc17cfad
feat(query-core): add simplified query methods (#10658)
* feat(query-core): add simplified query methods

* tests: stage adapter queryOptions coverage for new query methods

* ref: disallow `enabled`

* ci: apply automated fixes

* remove outdated test

* test(lit): remove other outdated test

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-17 13:59:13 +02:00
Amariah Abishai
bef4bc780c
fix(query-core): resolve suspense when query data is set programmatically (#11036)
* fix(query-core): resolve suspense when query data is set programmatically

When useSuspenseQuery is used and setQueryData populates the cache
while a fetch is in-flight, the suspense boundary stays stuck on the
original fetch promise. This prevents streamedQuery and manual cache
updates from releasing suspense.

Modify fetchOptimistic in queryObserver to use Promise.race between
the fetch promise and a cache subscriber that listens for 'updated'
events. When data appears in the cache via setQueryData or a streamed
chunk, the race resolves immediately without aborting the fetch.
This allows the suspense boundary to release and show the available
data while the fetch continues in the background.

Closes #10924

Co-authored-by: atlarix-agent <agent@atlarix.dev>

* chore: add changeset for suspense setQueryData fix

Co-authored-by: atlarix-agent <agent@atlarix.dev>

* fix(query-core): prevent subscription leak in fetchOptimistic on fetch rejection

unsubscribe() was only called in the .then() success path. If
query.fetch() rejected before the cache subscriber resolved the race,
the subscription leaked — staying registered on QueryCache indefinitely
and checking a stale queryHash on every 'updated' event.

Use .finally() to ensure unsubscribe() runs on both success and
rejection, preserving the original promise type through the chain.

Co-authored-by: atlarix-agent <agent@atlarix.dev>

* fix(query-core): settle floating promise in fetchOptimistic and add undefined test

- Resolve the subscriber promise when fetch succeeds so both branches
  of Promise.race always settle, avoiding a permanently pending promise
- Move resolution into .then() rather than .finally() so fetch failures
  still propagate through Promise.race rejection
- Add test: setQueryData with undefined must NOT release suspense,
  documenting the query.state.data !== undefined guard

Co-authored-by: atlarix-agent <agent@atlarix.dev>

* Update packages/query-core/src/queryObserver.ts

* test(queryObserver): cover cached data resolution

---------

Co-authored-by: DeepSeek V4 Pro agent <agent@atlarix.dev>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-17 10:19:39 +02:00
Alexander Kolesnik
5448063f82
fix(query-core): ignore a retained thenable callback invoked after settling (#11128)
* test(query-core): add unit tests for thenable

* fix(query-core): ignore a retained thenable callback invoked after settling

* chore: add changeset

* 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-08-17 09:52:21 +02:00