Skip to content

fix: resolve Verify Address crash caused by conditional hook call in ConnectChannel#6939

Open
Copilot wants to merge 3 commits into
feat/openspec-integrationfrom
copilot/fix-app-crash-verify-address-again
Open

fix: resolve Verify Address crash caused by conditional hook call in ConnectChannel#6939
Copilot wants to merge 3 commits into
feat/openspec-integrationfrom
copilot/fix-app-crash-verify-address-again

Conversation

Copy link
Copy Markdown

Copilot AI commented May 7, 2026

Tapping "Verify Address" on the Receive screen instantly crashed the app due to a React Rules of Hooks violation in ConnectChannel.tsx.

Root Cause

useVault was called inside a conditional block, which corrupts React's hook call order and causes an immediate runtime crash:

// ❌ Before — illegal hook call inside conditional
if (mode === InteracationMode.ADDRESS_VERIFICATION) {
  const { activeVault: vault } = useVault({ vaultId }); // crash
  ...
}

Fix

Hoisted useVault to the top level of ConnectChannel. The conditional block is retained solely for deriving address-verification values from the vault result:

// ✅ After — hook at top level, derivation gated by condition
const { activeVault: vault } = useVault({ vaultId });

if (mode === InteracationMode.ADDRESS_VERIFICATION) {
  // derive descriptorString, miniscriptPolicy, receivingAddress, etc.
}

Affects all hardware signers routed through ConnectChannel for address verification (BitBox02, Ledger, Trezor, Coldcard, Jade). No logic or UX changes.

Copilot AI linked an issue May 7, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits May 7, 2026 09:52
Co-authored-by: Parsh <17980466+Parsh@users.noreply.github.com>
…address crash

Co-authored-by: Parsh <17980466+Parsh@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix app crash on verify address in receive screen fix: resolve Verify Address crash caused by conditional hook call in ConnectChannel May 7, 2026
Copilot finished work on behalf of Parsh May 7, 2026 09:56
Copilot AI requested a review from Parsh May 7, 2026 09:56
@Parsh Parsh marked this pull request as ready for review May 7, 2026 09:59
@Parsh Parsh requested a review from cakesoft-vaibhav May 7, 2026 09:59
Copy link
Copy Markdown
Collaborator

@Parsh Parsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specs check: passed.

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.

App crashes on Verify Address in Receive screen

2 participants