Skip to content

[pull] main from TanStack:main - #604

Merged
pull[bot] merged 7 commits into
SimenB:mainfrom
TanStack:main
Aug 20, 2026
Merged

[pull] main from TanStack:main#604
pull[bot] merged 7 commits into
SimenB:mainfrom
TanStack:main

Conversation

@pull

@pullpullBot commented Aug 20, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

sukvvonand others added 7 commits August 20, 2026 16:09
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>
* 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>
…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>
* docs: add StitchAPI to community resources
* docs: reframe StitchAPI entry as a queryFn complement, not a competitor
* docs(example): dataloader
* use tanstack pacer instead of dataloader
* add staleTime
* switch to useAsyncBatchedCallback
* Revert "switch to useAsyncBatchedCallback"
This reverts commit 4d408da.
* fix: use PromiseWithResolvers
* add batching example to docs
@pullpullBot locked and limited conversation to collaborators Aug 20, 2026
@pull
pullBot merged commit 1ef4208 into SimenB:mainAug 20, 2026
4 of 5 checks passed
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@sukvvon@scttcper@n-satoshi061@S-jooyoung@rejifald@TkDodo