Skip to content

fix(frontend): ignore stale blueprint loads after route changes - #148

Open
ai-yang wants to merge 1 commit into
cloudflare:mainfrom
ai-yang:codex/fix-blueprint-route-race
Open

fix(frontend): ignore stale blueprint loads after route changes#148
ai-yang wants to merge 1 commit into
cloudflare:mainfrom
ai-yang:codex/fix-blueprint-route-race

Conversation

@ai-yang

@ai-yang ai-yang commented Aug 11, 2026

Copy link
Copy Markdown

Fixes #146

Summary

  • Ignore getBlueprint() callbacks after their route ID or RPC stub has been superseded.
  • Tie rendered blueprint data to the (id, rpcStub) that loaded it, so the old blueprint cannot flash during the first render of a new route.
  • Clear loaded/error state at the start of each load.

Without these guards, an older request could settle after the current request and overwrite the page. The URL and action handlers would then target the new blueprint ID while the UI displayed metadata from the old blueprint.

Regression coverage

The new component tests use controlled promises to verify that:

  • an A response resolving after B cannot replace B;
  • the first render after changing A to B shows loading rather than A;
  • a not-found B response does not leave A visible; and
  • a rejected B request shows B's error without leaving A visible.

Test plan

  • pnpm --filter @gadgets/workshop-frontend test — 28 test files / 140 tests passed
  • pnpm --filter @gadgets/workshop-frontend types:check
  • pnpm exec oxlint packages/workshop-frontend/src/BlueprintLandingPage.tsx packages/workshop-frontend/src/BlueprintLandingPage.test.tsx
  • git diff --check

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@github-actions github-actions Bot added the workshop/frontend Changes to the Workshop frontend label Aug 11, 2026
@ai-yang

ai-yang commented Aug 11, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@ai-yang
ai-yang marked this pull request as ready for review August 11, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

workshop/frontend Changes to the Workshop frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stale blueprint request can overwrite a newer route and target actions at the wrong blueprint

1 participant