Skip to content

fix: correct recent method routing#1284

Merged
jjramirezn merged 1 commit intopeanut-wallet-devfrom
fix/withdraw-recent-methods
Oct 3, 2025
Merged

fix: correct recent method routing#1284
jjramirezn merged 1 commit intopeanut-wallet-devfrom
fix/withdraw-recent-methods

Conversation

@jjramirezn
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Oct 3, 2025

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

Project Deployment Preview Comments Updated (UTC)
peanut-wallet Building Building Preview Comment Oct 3, 2025 7:55pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Adjusts 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

Cohort / File(s) Summary of changes
Withdraw flow initialization
src/app/(mobile-ui)/withdraw/page.tsx
Initial step now depends solely on selectedMethod (fallback to 'selectMethod' when absent); removed unused methodTitle computation in inputAmount view.
AddWithdraw router selection
src/components/AddWithdraw/AddWithdrawRouterView.tsx
onAccountClick now sets selectedMethod in context (type: 'manteca' or 'bridge', countryPath, title 'To Bank'); immediate routing retained only for MANTECA via router.push; second parameter marked unused.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • beetrootw
  • kushagrasarathe

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning No pull request description was provided by the author, leaving only a placeholder statement that fails to describe any aspect of the changeset. As a result, there is no explanation of the modifications to the withdrawal routing logic or context updates. This makes the description completely disconnected from the actual pull request content. Please include a concise pull request description that outlines the core fixes to the method routing logic, such as the refined initial step determination and the updated onAccountClick handler behavior. Providing this context will help reviewers understand the purpose and scope of the changes and facilitate an efficient review process.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly identifies the change as a fix to the method routing logic, which aligns with the primary modifications in the PR. It succinctly summarizes the developer’s intent without unnecessary detail. The “fix:” prefix indicates a bug correction and the phrase “recent method routing” accurately reflects the updated routing behavior.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/withdraw-recent-methods

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.

@coderabbitai coderabbitai bot added the enhancement New feature or request label Oct 3, 2025
@jjramirezn jjramirezn merged commit 2a8da32 into peanut-wallet-dev Oct 3, 2025
2 of 5 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 drop rawTokenAmount from 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

📥 Commits

Reviewing files that changed from the base of the PR and between 05070b7 and dc16c57.

📒 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 initialStep solely from selectedMethod correctly 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.countryName values align with the slug (path in ALL_METHODS_DATA) used for country routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants