Skip to content

Fix app-wallet add-account flow.#2174

Merged
prxt6529 merged 3 commits intomainfrom
fix-app-wallet-add-account-flow
Mar 27, 2026
Merged

Fix app-wallet add-account flow.#2174
prxt6529 merged 3 commits intomainfrom
fix-app-wallet-add-account-flow

Conversation

@prxt6529
Copy link
Copy Markdown
Collaborator

@prxt6529 prxt6529 commented Mar 27, 2026

Summary by CodeRabbit

  • Tests

    • Added comprehensive tests covering the add-account flow across wallet connector types and scenarios, asserting disconnect/open behavior, retry logic, and interactions across rerenders and repeated clicks.
  • Bug Fixes

    • Improved add-account flow to detect and prevent stale/duplicate attempts, distinguish app-wallet vs browser-wallet flows, and ensure correct disconnect vs direct-connect behavior with proper retry/timing handling.

Signed-off-by: prxt6529 <prxt@6529.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 565e1f22-a62c-462a-b34c-1dcf79bae3e5

📥 Commits

Reviewing files that changed from the base of the PR and between d9da870 and 96632c0.

📒 Files selected for processing (1)
  • __tests__/components/auth/SeizeConnectContext.addAccount.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/components/auth/SeizeConnectContext.addAccount.test.tsx

📝 Walkthrough

Walkthrough

Refactors the add-account control flow in SeizeConnectProvider to detect stale/duplicate add attempts, bypass disconnect+retry for app-wallet connectors, and wires Wagmi useAccount() for connector type detection; adds a comprehensive Jest/RTL test suite covering the new behaviors and edge cases.

Changes

Cohort / File(s) Summary
Test Suite
__tests__/components/auth/SeizeConnectContext.addAccount.test.tsx
New Jest + React Testing Library tests exercising seizeAddConnectedAccount under SeizeConnectProvider, mocking AppKit/Wagmi/hooks and asserting disconnect/open call sequences across app-wallet, browser-wallet, stale-flow, and no-live-wallet scenarios.
Add-Account Flow Logic
components/auth/SeizeConnectContext.tsx
Added useAccount() to detect connector.type and isActiveAppWalletConnector; refactored seizeAddConnectedAccount to remove prior early-return guard, add stale/duplicate-attempt detection, introduce bypass for app-wallet or no-live-wallet (skip disconnect()), preserve disconnect+retry for other cases, and update hook dependencies.

Sequence Diagram

sequenceDiagram
    participant User
    participant SeizeConnect as SeizeConnectProvider
    participant Wagmi
    participant AppKit

    User->>SeizeConnect: Click "Add Account" (seizeAddConnectedAccount)
    activate SeizeConnect

    SeizeConnect->>Wagmi: useAccount() → connector.type?
    Wagmi-->>SeizeConnect: connector.type

    alt App-wallet connector or no live connected wallet
        SeizeConnect->>AppKit: open({ view: "Connect" })
        Note over SeizeConnect: Bypass disconnect+retry
    else Browser-wallet connector with potential stale flow
        SeizeConnect->>SeizeConnect: detect stale/duplicate attempt?
        alt Stale detected
            SeizeConnect->>AppKit: disconnect()
            SeizeConnect->>SeizeConnect: set retry timeout / gating
            SeizeConnect->>AppKit: open({ view: "Connect" }) after retry
        else Fresh flow
            SeizeConnect->>AppKit: open({ view: "Connect" })
        end
    end

    deactivate SeizeConnect
    AppKit-->>User: Present connection UI
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • ragnep

Poem

🐰
I hop where connectors dance and play,
App-wallets skip the unplugged way,
Browser friends pause, then try once more,
Stale paths cleared, the flow's restore—
A carrot for tests, hip-hop hooray!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: fixing the app-wallet add-account flow, which aligns with the core modifications in SeizeConnectContext.tsx and the new test suite validating this behavior.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-app-wallet-add-account-flow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@prxt6529
Copy link
Copy Markdown
Collaborator Author

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 27, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
simo6529
simo6529 previously approved these changes Mar 27, 2026
@sonarqubecloud
Copy link
Copy Markdown

@prxt6529 prxt6529 merged commit 4c2de45 into main Mar 27, 2026
8 checks 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.

2 participants