Fix: application error and app stuck on home page#1264
Fix: application error and app stuck on home page#1264jjramirezn merged 1 commit intopeanut-wallet-devfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughIntroduces user-presence guards and dependency updates in balance-related effects on the mobile Home page, and tightens authentication/render gating in the mobile layout with a redirect for unauthenticated users. 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
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: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/app/(mobile-ui)/layout.tsx (1)
24-26: Include /setup in public paths so the setup flow renders while unauthenticatedWithout allowing /setup, the loader gate above will still block it. Minimal fix below (keeps your existing pattern style).
-// Allow access to some public paths without authentication -const publicPathRegex = /^\/(request\/pay|claim|pay\/.+$|support)/ +// Allow access to some public paths without authentication +const publicPathRegex = /^\/(setup|request\/pay|claim|pay\/.+$|support)/Optionally, consider a clearer pattern (future):
^/(setup|request/pay|claim|pay/[^/]+|support)(?:/.*)?$.src/app/(mobile-ui)/home/page.tsx (1)
158-178: Duplicate balance warning effect with looser conditions; unify to one sourceThis second effect duplicates the first but omits
!isPostSignupActionModalVisible, which can surface the warning over the post‑signup modal. It can also trigger redundant state updates. Remove or merge into a single effect (prefer the stricter first one).- // effect for showing balance warning modal - useEffect(() => { - if (isFetchingBalance || balance === undefined || !user) return - - if (typeof window !== 'undefined') { - const hasSeenBalanceWarning = getFromLocalStorage(`${user!.user.userId}-hasSeenBalanceWarning`) - const balanceInUsd = Number(formatUnits(balance, PEANUT_WALLET_TOKEN_DECIMALS)) - - // show if: - // 1. balance is above the threshold - // 2. user hasn't seen this warning in the current session - // 3. no other modals are currently active - if ( - balanceInUsd > BALANCE_WARNING_THRESHOLD && - !hasSeenBalanceWarning && - !showIOSPWAInstallModal && - !showAddMoneyPromptModal - ) { - setShowBalanceWarningModal(true) - } - } - }, [balance, isFetchingBalance, showIOSPWAInstallModal, showAddMoneyPromptModal, user])
🧹 Nitpick comments (1)
src/app/(mobile-ui)/home/page.tsx (1)
205-218: Minor: non-null assertion on username relies on layout auth gate
username!is fine given layout gating; if this component is ever reused outside that context, add a defensive check or derive from a single user source to avoid drift betweenuseAuthanduseUserStore.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/app/(mobile-ui)/home/page.tsx(3 hunks)src/app/(mobile-ui)/layout.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 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)/home/page.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Deploy-Preview
🔇 Additional comments (1)
src/app/(mobile-ui)/home/page.tsx (1)
134-156: Early exit on missing user is correct; prevents null accessThe
!userguard and addinguserto deps align the effect with auth state. Looks good.
No description provided.