fix: correct recent method routing#1284
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdjusts withdraw flow to rely on selectedMethod for initial step selection and transitions account clicks to set selectedMethod via context, only routing immediately for MANTECA accounts. Removes an unused variable in the input amount view and updates onAccountClick to ignore an unused parameter. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/app/(mobile-ui)/withdraw/page.tsx (1)
70-84: Refactor useEffect dependencies
In the effect at lines 70–84 in src/app/(mobile-ui)/withdraw/page.tsx, you can droprawTokenAmountfrom the dependency array—its only purpose there is to initialize the amount on method selection, and omitting it prevents the effect from running on every keystroke.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/app/(mobile-ui)/withdraw/page.tsx(1 hunks)src/components/AddWithdraw/AddWithdrawRouterView.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-18T09:30:42.901Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1230
File: src/app/(mobile-ui)/withdraw/page.tsx:92-97
Timestamp: 2025-09-18T09:30:42.901Z
Learning: In src/app/(mobile-ui)/withdraw/page.tsx, the useEffect that calls setShowAllWithdrawMethods(true) when amountFromContext exists is intentionally designed to run only on component mount (empty dependency array), not when amountFromContext changes. This is the correct behavior for the withdraw flow where showing all methods should only happen on initial load when an amount is already present.
Applied to files:
src/app/(mobile-ui)/withdraw/page.tsx
📚 Learning: 2025-05-22T15:38:48.586Z
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#869
File: src/app/(mobile-ui)/withdraw/page.tsx:82-88
Timestamp: 2025-05-22T15:38:48.586Z
Learning: The country-specific withdrawal route exists at src/app/(mobile-ui)/withdraw/[...country]/page.tsx and renders the AddWithdrawCountriesList component with flow="withdraw".
Applied to files:
src/app/(mobile-ui)/withdraw/page.tsx
📚 Learning: 2024-10-29T12:19:41.968Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#495
File: src/components/Global/TokenAmountInput/index.tsx:23-30
Timestamp: 2024-10-29T12:19:41.968Z
Learning: In the `TokenAmountInput` component (`src/components/Global/TokenAmountInput/index.tsx`), when the 'Max' button is clicked, we intentionally set the input denomination to 'TOKEN' because we are setting the value as token.
Applied to files:
src/app/(mobile-ui)/withdraw/page.tsx
🔇 Additional comments (2)
src/app/(mobile-ui)/withdraw/page.tsx (1)
36-36: LGTM: Initial step determination aligns with context-driven flow.The change to derive
initialStepsolely fromselectedMethodcorrectly implements the new withdraw flow where method selection via context determines whether the user proceeds directly to amount input.src/components/AddWithdraw/AddWithdrawRouterView.tsx (1)
189-201: Verify non-MANTECA withdrawal flow and countryPath mapping.
- Non-MANTECA accounts set context without immediate navigation; ensure the main withdraw page’s effect transitions to the amount input step on
selectedMethod.- Confirm
account.details.countryNamevalues align with the slug (pathinALL_METHODS_DATA) used for country routes.
No description provided.