Skip to content

fix: self-heal tabs running a stale build after deploys - #22

Merged
jayteemoney merged 2 commits into
mainfrom
fix/stale-tab-self-heal
Jul 13, 2026
Merged

fix: self-heal tabs running a stale build after deploys#22
jayteemoney merged 2 commits into
mainfrom
fix/stale-tab-self-heal

Conversation

@jayteemoney

Copy link
Copy Markdown
Owner

What

Minimal replacement for the reverted #20zero bundling changes (the part that broke #20 stays out).

Tabs opened before a deploy keep running the old bundle; clicking Connect lazily fetches a chunk the deploy deleted → users see module factory is not available. Now:

  • isStaleChunk classifies missing-chunk error shapes
  • StaleDeployGuard (global listeners) reloads once onto the current build, loop-protected
  • Wallet connect + signing catches show "StackStream was updated — refreshing…" and reload instead of module internals

Test plan

Preview-first: verified in a real browser on the Vercel preview before merging. Build + typecheck clean, 13/13 pages prerender.

Tabs opened before a deploy keep running the old bundle; when they
lazily load the wallet chunk the old hashed file is gone and the user
sees raw module errors ('module factory is not available'). Minimal
fix, no bundling changes:

- isStaleChunk classifier for missing-chunk error shapes.
- StaleDeployGuard: global error/unhandledrejection listeners reload
  once onto the current build (sessionStorage loop protection).
- Wallet connect and signing catches show 'StackStream was updated,
  refreshing' and reload instead of surfacing module internals.
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stackstream Ready Ready Preview, Comment Jul 13, 2026 9:49am

… graph

Root cause of every 'module factory is not available' failure since the
v8 migration: Turbopack (Next 16.1.6) mis-wires @stacks/connect's
lazily-imported module graph in production builds, so clicking Connect
always failed in Turbopack-built bundles — on first load, any browser.
It only ever worked in dev because dev bundling differs. Not a stale-
cache problem; module ids were stable across builds because the defect
is deterministic.

Reproduced headlessly (puppeteer clicking Connect on a served
production build) and verified fixed: with --webpack the wallet
chooser opens with zero console errors. transpilePackages did not fix
the Turbopack graph, so the build script switches bundlers; dev stays
on Turbopack, where the package bundles fine.
@jayteemoney
jayteemoney merged commit 5979e7c into main Jul 13, 2026
2 of 4 checks passed
@jayteemoney
jayteemoney deleted the fix/stale-tab-self-heal branch July 13, 2026 09:59
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