Chore/fix chain bug - #1069
Conversation
📝 WalkthroughWalkthroughA new activity-aware chain-switching hook synchronizes wallets to active route chains only in focused, visible documents. Token context and Index DTF routes use the hook, with expanded effect dependencies and regression tests covering background and recovery states. ChangesFocused-tab chain switching
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant Route as Index DTF or token route
participant Hook as useActiveChainSwitch
participant Document as Browser document
participant Wallet as wagmi switchChain
Route->>Hook: provide route chain
Hook->>Document: check focus and visibility
Hook->>Wallet: request route chain when active
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Deploying register-app with
|
| Latest commit: |
3c8f1aa
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b1d09244.register-app.pages.dev |
| Branch Preview URL: | https://chore-fix-chain-bug.register-app.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/hooks/use-active-chain-switch.ts`:
- Around line 36-50: Update the useEffect switch flow in
use-active-chain-switch.ts to use switchChainAsync and handle rejected or
unsupported chain switches. Resolve the target chain name and surface failures
through the existing wallet-error toast UX, following the pattern in
seamless-transaction.tsx, while preserving the current activation and
chain-mismatch conditions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5dd55a62-e8cd-4505-8df3-e5800741bbdd
📒 Files selected for processing (7)
docs/wiki/log.mddocs/wiki/progress.mddocs/wiki/project.mdsrc/hooks/tests/use-active-chain-switch.test.tsxsrc/hooks/use-active-chain-switch.tssrc/hooks/useRTokenContext.tssrc/views/index-dtf/index-dtf-container.tsx
Summary by CodeRabbit
New Features
Bug Fixes
Tests