Repository navigation
fix(query-broadcast-client-experimental): keep error state of settled queries on added broadcasts - #12704
fix(query-broadcast-client-experimental): keep error state of settled queries on added broadcasts#12704draarivpatel-ui wants to merge 1 commit into
Conversation
… queries on `added` broadcasts When another tab creates a query, the receiving tab applied the sender's initial state whenever its own query had no data. A query that settled in error has no data either, so it was replaced with the sender's brand-new pending state: the error was lost and the query looked like it was loading while no fetch was running. Only adopt the sender's initial state for queries that have not settled yet. Fixes TanStack#12213
🦋 Changeset detectedLatest commit: 56d94f4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Changes
When another tab creates a query, the receiving tab applied the sender's initial state on
addedwhenever its own query had nodata. A query that already settled in error has no data either, so it was replaced with the sender's brand-new state:status: 'pending',error: null,errorUpdatedAt: 0. The error was lost and observers rendered a pending UI indefinitely without any fetch running, exactly as described in the issue.addedmessages carry the sender's initial state at creation time, so adopting them is only ever meaningful for a query that has not settled yet. The receiver now also requireserrorUpdatedAt === 0before adopting, so a query that already failed keeps its error state.Fixes #12213
Checklist
pnpm run test:prmatrix does not apply to this single-package change and was not run).Release impact
@tanstack/query-broadcast-client-experimental).Verification
addedmessage with a fresh pending state arrives.main(1 failed, 13 passed) and passes with the fix (14 passed,vitest runfor@tanstack/query-broadcast-client-experimental).added-handling tests still pass: queries with data are never overwritten, and unsettled queries with no data still adopt the sender's state.Summary by CodeRabbit