Skip to content

Fix crash on load when no wallet extension is installed#3

Open
drhus wants to merge 1 commit into
mainfrom
fix/guard-missing-wallet
Open

Fix crash on load when no wallet extension is installed#3
drhus wants to merge 1 commit into
mainfrom
fix/guard-missing-wallet

Conversation

@drhus

@drhus drhus commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Problem

or.immo shows "Application error: a client-side exception has occurred" for any visitor without a browser wallet - which includes every mobile browser. Console:

TypeError: Cannot read properties of undefined (reading 'networkVersion')

NavBar renders <InstallSnap displayManualInstall={true}/> on every page, and InstallSnap reads window.ethereum.networkVersion without checking that a wallet is injected. No MetaMask → window.ethereum is undefined → React unmounts the whole page.

Fix

Optional-chain the three unguarded window.ethereum accesses (InstallSnap.tsx, snap.ts). With no wallet the page now renders fully; the OR Snap button remains visible and clicking it is a harmless no-op (win.ethereum?.request short-circuits). Note: Chakra's Button does not apply the plain disabled prop to the DOM (pre-existing - it wants isDisabled), so the button is not greyed out; left as-is to keep this fix minimal. Behavior with MetaMask is unchanged.

Verification

  • Rendered this branch locally (next dev) in headless Chrome with no wallet: full homepage renders, zero exceptions (screenshot-verified).
  • next build: compile + type check pass. (Page-data collection fails locally on Node 22 with a pre-existing import ... assert issue in /dashboard; Vercel builds on Node 20.x where it works.)
  • Reproduced the crash headlessly on the live site before the fix.

🤖 Generated with Claude Code

InstallSnap read window.ethereum.networkVersion unguarded; on any browser
without MetaMask (all mobile) this threw and took down the whole page with
"Application error: a client-side exception has occurred". NavBar renders
InstallSnap on every page, so the site was unusable without a wallet.

Guard the accesses with optional chaining - without a wallet the OR Snap
button now renders disabled instead of crashing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
or-immo Ready Ready Preview, Comment Jul 24, 2026 7:14am

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