fix: prevent hoisted spinner React mismatch in Bun installs - #312
Open
awesamarth wants to merge 1 commit into
Open
fix: prevent hoisted spinner React mismatch in Bun installs#312awesamarth wants to merge 1 commit into
awesamarth wants to merge 1 commit into
Conversation
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.
Summary
Fix
link-cli onboardcrashing withInvalid hook call/Cannot read properties of null (reading 'useState')after a Bun global install. The same spinner is used by other interactive commands.In the affected installation (macOS, Bun 1.3.14, CLI 0.18.0), Ink resolves the CLI's nested React 18.3.1, while the hoisted
ink-spinnerresolves global React 19.2.7. The spinner's hooks therefore use a different React instance from the renderer. This depends on the installed dependency layout; a clean install will not necessarily reproduce it.ink-spinnerthrough tsup'snoExternaloption, keeping its React/Ink imports in the CLI's dependency scope. React and Ink themselves remain external.Validation
Reproduced the exact
useStatecrash with the pre-fix tarball; the patched tarball passes the same check.pnpm turbo run build typecheck— passed.pnpm biome check .— passed.CLI Vitest suite — 322 tests passed; SDK Vitest suite — 137 tests passed (isolated HOME to protect local credentials).
node scripts/test-bun-install.mjs— passed. Requires Bun and pnpm; intentionally opt-in, not part of the regular offline unit suite.Installed the patched tarball globally using Bun and confirmed onboarding no longer crashes on the reporting machine.
Go SDK checks — formatting clean,
go mod tidy -diff,go vet ./..., andgo test -race ./...all passed (Go 1.27.1).Validation covers the interactive startup regression, not end-to-end payment processing.
To repeat the packaging check:
pnpm install --frozen-lockfile pnpm turbo run build node scripts/test-bun-install.mjs # To verify the regression against an older build: node scripts/test-bun-install.mjs /path/to/pre-fix-cli.tgzThis is separate from #298 (Bun automatically starting a server from the default export); this PR does not address that hang.