fix: deploy-proof wallet path + self-healing stale tabs - #20
Merged
Conversation
'Module factory is not available' — the wallet library was dynamically imported, so it lived in a lazy chunk fetched at click time. Every deploy replaces the hashed chunk files, so any tab opened before a deploy lost the wallet chunk the moment the user clicked Connect. With frequent deploys this broke the money path for every open tab. Two layers, both root-cause: - Import @stacks/connect statically (~10 KB gz) so the wallet path ships in the initial bundle and has no lazy chunk to lose. Turbopack cannot wire the package's server-side module graph during prerender, so it is declared in serverExternalPackages and resolved natively by Node on the server. - StaleDeployGuard: global error/unhandledrejection listeners detect missing-chunk failures anywhere in the app (route chunks included) and reload once onto the new build, loop-protected via sessionStorage. Wallet flows additionally catch the same condition and reload with a friendly 'StackStream was updated' toast instead of surfacing module internals. Verified on the production build: all 13 pages prerender, wallet code present in the eager bundle, guard present, API routes serving.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
jayteemoney
added a commit
that referenced
this pull request
Jul 13, 2026
revert: deploy-proof wallet wiring (#20) — broke production client-side
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.
Root cause (final one)
"Module factory is not available" = a stale-bundle failure, not a wallet failure. The wallet library was loaded via dynamic
import()— a lazy chunk fetched at click time. Every deploy replaces the content-hashed chunks, so any tab opened before a deploy breaks on the money path the moment the user clicks Connect. We deployed 3× in hours; every open visitor tab hit this.The wiring (both layers root-cause)
@stacks/connectimported statically — the wallet path ships in the initial bundle (~10 KB gz); there is no lazy chunk to lose, ever. Turbopack can't prerender the package's server module graph, so it's declared inserverExternalPackages(Node resolves it natively server-side — verified).StaleDeployGuard— global listeners detect missing-chunk errors anywhere (page route chunks too), and reload once onto the new build (sessionStorage loop protection). Wallet flows catch the same condition with a friendly "StackStream was updated — refreshing…" toast.Verified on the production build