* chore(*): adopt '@tanstack/oxlint-config' and '@tanstack/oxfmt-config', and fix the newly reported lint errors
* chore(pnpm-lock.yaml): run 'pnpm dedupe'
* chore(scripts): move 'oxlint/plugin.ts' to 'oxlint-plugin.ts' to match the flat layout of 'scripts'
* chore(pnpm-workspace.yaml): update '@typescript-eslint/parser' and '@typescript-eslint/rule-tester' to '^8.72.1' to match the deduped '@typescript-eslint/utils'
* 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>
* add timeoutManager class
* add additional types & export functions
* convert all setTimeout/setInterval to managed versions
* tweaks
* add claude-generated tests
* tests
* revert changes in query-async-storage-persister: no path to import query-core
* re-export more types
* console.warn -> non-production console.error
* query-async-storage-persister: use query-core managedSetTimeout
* pdate pnpm-lock for new dependency edge
* sleep: always managedSetTimeout
* remove managed* functions, call method directly
* remove runtime coercion and accept unsafe any within TimeoutManager class
* cleanup; fix test after changes
* name is __TEST_ONLY__
* notifyManager: default scheduler === systemSetTimeoutZero
* Improve TimeoutCallback comment since ai was confused
* remove unnecessary timeoutManager-related exports
* prettier-ify index.ts (seems my editor messed with it already this pr?)
* continue to export defaultTimeoutProvider for tests
* oops missing import
* fix: export systemSetTimeoutZero from core
* ref: use notifyManager.schedule in createPersister
because it needs to work with whatever scheduleFn we have set there
* ref: move provider check behind env check
* docs
* doc tweaks
* doc tweaks
* docs: reference timeoutManager in discussion of 24 day setTimout limit
* Apply suggestion from @TkDodo
* Apply suggestion from @TkDodo
* chore: fix broken links
* docs: syntax fix
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* Add persisterRestoreByKey
* Fix imports
* Add missing return statement
* Fix test
* docs
* Add extra test
* Merge into single restoreQueries function
* 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`.
* fix(persistQueryClientRestore): Do not swallow exceptions during in persistQueryClientRestore within `restoreClient` and `removeClient`
* fix: rethrow errors in removeClient within all branches
* fix: test for PersistQueryClientProvider in all consumers
* chore: implement PR feedback
* chore: mock console calls, so they do not end up in the console. This way we can also assert on the invocations
* chore: consoleWarn mocks to be restored after each test
* chore: remove tmp file commited accidentally
* chore: adjust docs and include new optional callback `onError`
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* wip - 1
* Fix more links
* Fix one more link
* Another one
* Update a link
* Fix the broken links in the Angular docs
* Fix the broken links in the Vue docs
* Fix the Svelte links in the docs
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
TanStack Router uses path-based navigation instead of route-based navigation, so many of the relative documentation links will be invalid after migration. This fixes that.