fix: self-heal tabs running a stale build after deploys - #22
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Minimal replacement for the reverted #20 — zero 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:isStaleChunkclassifies missing-chunk error shapesStaleDeployGuard(global listeners) reloads once onto the current build, loop-protectedTest plan
Preview-first: verified in a real browser on the Vercel preview before merging. Build + typecheck clean, 13/13 pages prerender.