Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughWhen an invite code and initial step are present, the setup flow now conditionally routes Android devices not running as a standalone PWA to an Android PWA install view; other cases continue to the signup step. No public signatures changed. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ 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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/app/(setup)/setup/page.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1251
File: src/app/invite/page.tsx:44-53
Timestamp: 2025-09-25T11:18:10.633Z
Learning: The setup page (/setup) contains the waitlist functionality in the welcome step using the JoinWaitlist component, so redirecting users to /setup for joining the waitlist is correct.
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1089
File: src/components/LandingPage/dropLink.tsx:35-42
Timestamp: 2025-08-12T17:44:04.268Z
Learning: In the Peanut UI project, opening the `/setup` route in a new tab from landing page CTAs is intentional design behavior to keep users on the marketing page while they start the setup process.
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1241
File: src/components/ForceIOSPWAInstall/index.tsx:6-51
Timestamp: 2025-10-15T06:45:22.055Z
Learning: In the ForceIOSPWAInstall component (src/components/ForceIOSPWAInstall/index.tsx), the blocking behavior without a skip/dismiss option is intentional by design to force PWA installation on iOS devices.
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1251
File: src/components/Invites/JoinWaitlistPage.tsx:41-55
Timestamp: 2025-09-29T18:34:33.596Z
Learning: In the JoinWaitlistPage component, after successfully accepting an invite via invitesApi.acceptInvite(), calling fetchUser() is sufficient to update the user state and automatically display the app. No manual navigation to /home or other pages is required since the user is already on the home page and the app will be displayed once user.hasAppAccess is updated.
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1072
File: src/app/(setup)/setup/page.tsx:173-175
Timestamp: 2025-08-07T12:53:50.946Z
Learning: In the peanut-ui setup flow at `src/app/(setup)/setup/page.tsx`, when handling unsupported scenarios, both device not supported and browser not supported cases should show the same "Unsupported browser" message using the `UnsupportedBrowserModal` component, rather than having distinct messaging for each scenario.
📚 Learning: 2025-08-07T12:53:50.946Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1072
File: src/app/(setup)/setup/page.tsx:173-175
Timestamp: 2025-08-07T12:53:50.946Z
Learning: In the peanut-ui setup flow at `src/app/(setup)/setup/page.tsx`, when handling unsupported scenarios, both device not supported and browser not supported cases should show the same "Unsupported browser" message using the `UnsupportedBrowserModal` component, rather than having distinct messaging for each scenario.
Applied to files:
src/app/(setup)/setup/page.tsx
📚 Learning: 2025-09-29T18:34:33.596Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1251
File: src/components/Invites/JoinWaitlistPage.tsx:41-55
Timestamp: 2025-09-29T18:34:33.596Z
Learning: In the JoinWaitlistPage component, after successfully accepting an invite via invitesApi.acceptInvite(), calling fetchUser() is sufficient to update the user state and automatically display the app. No manual navigation to /home or other pages is required since the user is already on the home page and the app will be displayed once user.hasAppAccess is updated.
Applied to files:
src/app/(setup)/setup/page.tsx
📚 Learning: 2025-10-08T17:13:13.155Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1299
File: src/app/(mobile-ui)/points/page.tsx:41-51
Timestamp: 2025-10-08T17:13:13.155Z
Learning: In `src/app/(mobile-ui)/points/page.tsx`, the icon name "invite-heart" is intentionally used (not "inviter-heart") when displaying who invited the current user, as this is a deliberate design choice despite semantic differences with UserHeader usage.
Applied to files:
src/app/(setup)/setup/page.tsx
📚 Learning: 2025-09-25T11:18:10.633Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1251
File: src/app/invite/page.tsx:44-53
Timestamp: 2025-09-25T11:18:10.633Z
Learning: The setup page (/setup) contains the waitlist functionality in the welcome step using the JoinWaitlist component, so redirecting users to /setup for joining the waitlist is correct.
Applied to files:
src/app/(setup)/setup/page.tsx
🧬 Code graph analysis (1)
src/app/(setup)/setup/page.tsx (2)
src/components/Setup/Setup.types.ts (1)
ISetupStep(43-55)src/redux/slices/setup-slice.ts (1)
setupActions(69-69)
⏰ 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/(setup)/setup/page.tsx (1)
129-138: The review comment is based on an incorrect interpretation of the code flow.The code at lines 129-138 determines which step to initially navigate to when entering the setup flow, not the progression from
android-initial-pwa-install. The logic correctly distinguishes between two initial entry points:
- Android users not in standalone PWA mode start at
android-initial-pwa-install(index 1)- All other users start at
signup(index 5)The actual progression from
android-initial-pwa-installfollows the setupSteps array order:android-initial-pwa-install(index 1) →pwa-install(index 2) →landing(index 3) →welcome(index 4) →signup(index 5), which is the correct flow design.Likely an incorrect or invalid review comment.
| // if user is on android and not in a standalone pwa, force them to install the PWA first | ||
| if (localDeviceType === 'android' && !isStandalonePWA) { | ||
| const androidInitialPwaInstallScreenIndex = steps.findIndex( | ||
| (s: ISetupStep) => s.screenId === 'android-initial-pwa-install' | ||
| ) | ||
| dispatch(setupActions.setStep(androidInitialPwaInstallScreenIndex + 1)) | ||
| } else { | ||
| const signupScreenIndex = steps.findIndex((s: ISetupStep) => s.screenId === 'signup') | ||
| dispatch(setupActions.setStep(signupScreenIndex + 1)) | ||
| } |
There was a problem hiding this comment.
Add missing error handling for findIndex results.
The code uses findIndex to locate step indices but doesn't check if the step exists (returns -1), unlike the existing logic at lines 140-148 which properly handles this case. If either 'android-initial-pwa-install' or 'signup' steps are missing from the steps array, this would dispatch invalid step indices.
Apply this diff to add consistent error handling:
// If invite code is present, set the step to the signup screen
if (determinedSetupInitialStepId && userInviteCode) {
// if user is on android and not in a standalone pwa, force them to install the PWA first
if (localDeviceType === 'android' && !isStandalonePWA) {
const androidInitialPwaInstallScreenIndex = steps.findIndex(
(s: ISetupStep) => s.screenId === 'android-initial-pwa-install'
)
- dispatch(setupActions.setStep(androidInitialPwaInstallScreenIndex + 1))
+ if (androidInitialPwaInstallScreenIndex !== -1) {
+ dispatch(setupActions.setStep(androidInitialPwaInstallScreenIndex + 1))
+ } else {
+ console.warn('Could not find android-initial-pwa-install step. Defaulting to step 1.')
+ dispatch(setupActions.setStep(1))
+ }
} else {
const signupScreenIndex = steps.findIndex((s: ISetupStep) => s.screenId === 'signup')
- dispatch(setupActions.setStep(signupScreenIndex + 1))
+ if (signupScreenIndex !== -1) {
+ dispatch(setupActions.setStep(signupScreenIndex + 1))
+ } else {
+ console.warn('Could not find signup step. Defaulting to step 1.')
+ dispatch(setupActions.setStep(1))
+ }
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // if user is on android and not in a standalone pwa, force them to install the PWA first | |
| if (localDeviceType === 'android' && !isStandalonePWA) { | |
| const androidInitialPwaInstallScreenIndex = steps.findIndex( | |
| (s: ISetupStep) => s.screenId === 'android-initial-pwa-install' | |
| ) | |
| dispatch(setupActions.setStep(androidInitialPwaInstallScreenIndex + 1)) | |
| } else { | |
| const signupScreenIndex = steps.findIndex((s: ISetupStep) => s.screenId === 'signup') | |
| dispatch(setupActions.setStep(signupScreenIndex + 1)) | |
| } | |
| // if user is on android and not in a standalone pwa, force them to install the PWA first | |
| if (localDeviceType === 'android' && !isStandalonePWA) { | |
| const androidInitialPwaInstallScreenIndex = steps.findIndex( | |
| (s: ISetupStep) => s.screenId === 'android-initial-pwa-install' | |
| ) | |
| if (androidInitialPwaInstallScreenIndex !== -1) { | |
| dispatch(setupActions.setStep(androidInitialPwaInstallScreenIndex + 1)) | |
| } else { | |
| console.warn('Could not find android-initial-pwa-install step. Defaulting to step 1.') | |
| dispatch(setupActions.setStep(1)) | |
| } | |
| } else { | |
| const signupScreenIndex = steps.findIndex((s: ISetupStep) => s.screenId === 'signup') | |
| if (signupScreenIndex !== -1) { | |
| dispatch(setupActions.setStep(signupScreenIndex + 1)) | |
| } else { | |
| console.warn('Could not find signup step. Defaulting to step 1.') | |
| dispatch(setupActions.setStep(1)) | |
| } | |
| } |
🤖 Prompt for AI Agents
In src/app/(setup)/setup/page.tsx around lines 129 to 138, the code calls
findIndex for 'android-initial-pwa-install' and 'signup' but doesn't handle a -1
result; mirror the existing handling at lines 140-148 by checking the found
index for -1, and if -1 log an error (or console.error) and dispatch a safe
fallback (e.g., setStep(0) or the same fallback used later) instead of
dispatching an invalid index; otherwise dispatch setStep(foundIndex + 1) as
before.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/Setup/Views/InstallPWA.tsx(4 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1089
File: src/components/LandingPage/dropLink.tsx:35-42
Timestamp: 2025-08-12T17:44:04.268Z
Learning: In the Peanut UI project, opening the `/setup` route in a new tab from landing page CTAs is intentional design behavior to keep users on the marketing page while they start the setup process.
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1251
File: src/components/Invites/JoinWaitlistPage.tsx:41-55
Timestamp: 2025-09-29T18:34:33.596Z
Learning: In the JoinWaitlistPage component, after successfully accepting an invite via invitesApi.acceptInvite(), calling fetchUser() is sufficient to update the user state and automatically display the app. No manual navigation to /home or other pages is required since the user is already on the home page and the app will be displayed once user.hasAppAccess is updated.
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1251
File: src/app/invite/page.tsx:44-53
Timestamp: 2025-09-25T11:18:10.633Z
Learning: The setup page (/setup) contains the waitlist functionality in the welcome step using the JoinWaitlist component, so redirecting users to /setup for joining the waitlist is correct.
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1241
File: src/components/ForceIOSPWAInstall/index.tsx:6-51
Timestamp: 2025-10-15T06:45:22.055Z
Learning: In the ForceIOSPWAInstall component (src/components/ForceIOSPWAInstall/index.tsx), the blocking behavior without a skip/dismiss option is intentional by design to force PWA installation on iOS devices.
📚 Learning: 2025-09-29T18:34:33.596Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1251
File: src/components/Invites/JoinWaitlistPage.tsx:41-55
Timestamp: 2025-09-29T18:34:33.596Z
Learning: In the JoinWaitlistPage component, after successfully accepting an invite via invitesApi.acceptInvite(), calling fetchUser() is sufficient to update the user state and automatically display the app. No manual navigation to /home or other pages is required since the user is already on the home page and the app will be displayed once user.hasAppAccess is updated.
Applied to files:
src/components/Setup/Views/InstallPWA.tsx
📚 Learning: 2025-09-25T11:18:10.633Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1251
File: src/app/invite/page.tsx:44-53
Timestamp: 2025-09-25T11:18:10.633Z
Learning: The setup page (/setup) contains the waitlist functionality in the welcome step using the JoinWaitlist component, so redirecting users to /setup for joining the waitlist is correct.
Applied to files:
src/components/Setup/Views/InstallPWA.tsx
📚 Learning: 2025-10-15T06:45:22.055Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1241
File: src/components/ForceIOSPWAInstall/index.tsx:6-51
Timestamp: 2025-10-15T06:45:22.055Z
Learning: In the ForceIOSPWAInstall component (src/components/ForceIOSPWAInstall/index.tsx), the blocking behavior without a skip/dismiss option is intentional by design to force PWA installation on iOS devices.
Applied to files:
src/components/Setup/Views/InstallPWA.tsx
🧬 Code graph analysis (1)
src/components/Setup/Views/InstallPWA.tsx (2)
src/components/Setup/Setup.types.ts (1)
ISetupStep(43-55)src/redux/slices/setup-slice.ts (1)
setupActions(69-69)
⏰ 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
| // If user is on android and has an invite code, redirect to signup screen | ||
| if (inviteCode && deviceType === DeviceType.ANDROID) { | ||
| const signupScreeenIndex = steps.findIndex((s: ISetupStep) => s.screenId === 'signup') | ||
| dispatch(setupActions.setStep(signupScreeenIndex + 1)) | ||
| } else { | ||
| handleNext() | ||
| } |
There was a problem hiding this comment.
Fix typos and add error handling for missing signup step.
Issues identified:
- Typo in variable name (line 226):
signupScreeenIndexhas three 'e's—should besignupScreenIndex. - Typo in comment (line 224): "screeeen" should be "screen".
- Logic clarification needed: The comment states "redirect to signup screen", but the code navigates to
signupScreenIndex + 1(the step after signup). Please verify if the intent is to navigate TO the signup step or to the step AFTER signup. - Missing error handling: If the signup step is not found,
findIndexreturns-1, causingsetStep(0)to be dispatched, which may not be the desired behavior.
Apply this diff to fix the typos and add error handling:
- // If user is on android and has an invite code, redirect to signup screen
+ // If user is on android and has an invite code, redirect to signup screen
if (inviteCode && deviceType === DeviceType.ANDROID) {
- const signupScreeenIndex = steps.findIndex((s: ISetupStep) => s.screenId === 'signup')
- dispatch(setupActions.setStep(signupScreeenIndex + 1))
+ const signupScreenIndex = steps.findIndex((s: ISetupStep) => s.screenId === 'signup')
+ if (signupScreenIndex !== -1) {
+ dispatch(setupActions.setStep(signupScreenIndex + 1))
+ } else {
+ // Fallback to handleNext if signup step not found
+ handleNext()
+ }
} else {
handleNext()
}Note: If the intent is to navigate TO the signup step (not after it), remove the + 1. Please clarify the expected navigation target and update the comment accordingly.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // If user is on android and has an invite code, redirect to signup screen | |
| if (inviteCode && deviceType === DeviceType.ANDROID) { | |
| const signupScreeenIndex = steps.findIndex((s: ISetupStep) => s.screenId === 'signup') | |
| dispatch(setupActions.setStep(signupScreeenIndex + 1)) | |
| } else { | |
| handleNext() | |
| } | |
| // If user is on android and has an invite code, redirect to signup screen | |
| if (inviteCode && deviceType === DeviceType.ANDROID) { | |
| const signupScreenIndex = steps.findIndex((s: ISetupStep) => s.screenId === 'signup') | |
| if (signupScreenIndex !== -1) { | |
| dispatch(setupActions.setStep(signupScreenIndex + 1)) | |
| } else { | |
| // Fallback to handleNext if signup step not found | |
| handleNext() | |
| } | |
| } else { | |
| handleNext() | |
| } |
🤖 Prompt for AI Agents
In src/components/Setup/Views/InstallPWA.tsx around lines 224 to 230, fix the
typos and add error handling: rename signupScreeenIndex to signupScreenIndex and
correct the comment to "screen"; determine navigation target — if the intent is
to go TO the signup step remove the "+ 1" when calling setStep, otherwise keep
it to go after signup; add a guard after findIndex that checks for -1 and, in
that case, log an error/warning and fall back to handleNext() (do not dispatch
setStep(0) silently).
No description provided.