Skip to content

prefetchItxQuery: no errored residue after a failed first fetch#1469

Merged
jonastemplestein merged 1 commit into
mainfrom
itx-prefetch-no-poison
Jun 10, 2026
Merged

prefetchItxQuery: no errored residue after a failed first fetch#1469
jonastemplestein merged 1 commit into
mainfrom
itx-prefetch-no-poison

Conversation

@jonastemplestein

@jonastemplestein jonastemplestein commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #1457, addressing bugbot's "failed prefetch poisons query cache" finding: a swallowed prefetch failure left an errored, data-less entry on the shared query key, so the consuming component (streams tree, breadcrumb navigators) flashed its error state on mount before retryOnMount refetched. The catch now removes the entry when it is errored and empty — components mount pending and fetch fresh. Entries that already hold data are kept (stale data + background error beats no data), covered by a new revalidation test.

🤖 Generated with Claude Code


Note

Low Risk
Narrow loader/cache hygiene change with matching unit tests; no auth or API surface changes.

Overview
Fixes a prefetch cache poisoning issue: when prefetchItxQuery swallowed a failure on a first fetch, React Query still left an errored, data-less entry on the shared key, so streams tree / breadcrumb UI briefly showed error on mount before retryOnMount refetched.

After the catch, the loader now removeQueries when state is error and data is undefined, so consumers mount pending and fetch fresh. Stale entries with existing data are untouched when revalidation fails—stale data is preferred over wiping the cache.

Tests now assert no cache residue on failed prefetch and add coverage for failed revalidation with seeded data.

Reviewed by Cursor Bugbot for commit 3219b15. Bugbot is set up for automated code reviews on this repo. Configure here.

Environment Config Lease

No active environment config lease.

OS

Status: released
Commit: 3219b15
Preview: https://os.iterate-preview-4.com
Summary: Preview app released.
Workflow run
Updated: 2026-06-10T18:09:44.936Z

Bugbot on #1457: a swallowed prefetch failure left an errored,
data-less cache entry on the shared key, so the consuming component
flashed its error state on mount before retryOnMount recovered. The
catch now removes the entry when it is errored AND empty — the
component mounts pending and fetches fresh. An entry that already has
data is kept: stale data plus a background error beats no data.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jonastemplestein jonastemplestein merged commit 7274a47 into main Jun 10, 2026
8 checks passed
@jonastemplestein jonastemplestein deleted the itx-prefetch-no-poison branch June 10, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant