docs(preact-query): add Suspense and Testing guides
The Preact docs had no counterpart for the React "Suspense" and
"Testing" guides even though `@tanstack/preact-query` ships the
suspense hooks and `QueryErrorResetBoundary`.
Follow the existing Preact docs convention: reference the React guide
via `ref:` + `replace:` and override only the React-specific sections
(`preact/compat` Suspense, an error boundary built on `useErrorBoundary`,
`@testing-library/preact`). The React guides only gain the section
markers needed for the overrides; their wording is unchanged.
* chore(scripts/generate-docs): inject 'redirect_from' into flat reference URLs
* docs(react-query, solid-query): add 'redirect_from' for URLs broken by the TypeDoc migration
* docs(vue-query,solid-query): inline react reference content instead of 'ref'-ing hand-written react docs
* docs(react-query): generate reference docs with TypeDoc
* docs(vue-query,solid-query): fix dangling suspense-hook links left over from the react content copy
* docs(solid-query): apply solid's callback call form to inlined reference examples
* docs(react-query): correct inaccurate JSDoc statements flagged in review
* docs(vue-query,solid-query): fix reactivity-aware examples and inaccurate type signatures flagged in review
* docs(vue-query,solid-query): fix remaining type/behavior inaccuracies flagged in second review
* docs(react-query): stop implying a default queryFn defers a fetch the way 'enabled: false' does
* docs(vue-query): mark 'mutate'/'mutateAsync' per-call options as optional
* 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>
Currently there is a bug, which prevents proper rendering of the links if there are both MD & HTML syntax in the same line (see https://tanstack.com/query/latest/docs/framework/react/devtools), probably should be fixed in @tanstack/markdown. Not sure that the source code of this package is published?
In the meantime, I just converted all links to html.
Converting everything (logos) to markdown won't work because we need to set width/height, which can't be done in markdown
Inlining a `select` on a query object passed to `useQueries` /
`useSuspenseQueries` can't infer its `data` argument from the sibling
`queryFn` and falls back to `unknown` — a known TypeScript limitation
(TanStack/query#6556).
Document the two workarounds (annotate the `select` parameter, or define
the query with the `queryOptions` helper) in the React docs, and add type
tests guarding the behavior. Scoped to React for an easier review; the
other framework adapters can follow the same pattern in separate PRs.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* docs(devtools): replace framework-specific logo with 'TanStack logo' to match the actual rendered component
* docs(vue-query/devtools): replace 'React Query' panel leftover with 'Vue Query'
* docs(devtools): replace framework-specific logo with 'TanStack logo' and use adapter naming for 'devtools panel' in JSDoc
* docs(devtools): add missing 'relative' to JSDoc 'buttonPosition' union
* chore(.changeset): add changeset for devtools logo, panel, and 'buttonPosition' union alignment
* docs(preact-query-devtools): add missing 'position' union to JSDoc
* fix(devtools): change onClose callback type from () => unknown to () => void
* Fix onClose callback type in devtools
Updated onClose callback type in devtools to improve type safety.
* chore(changeset): fixed truncated changeset description
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* 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>
* docs(react): clarify staleTime 'static' vs Infinity with 'always' triggers
* docs(react): lead with invalidateQueries() distinction for staleTime: 'static' vs Infinity