Conversation
🦋 Changeset detectedLatest commit: c259fda The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughFetches KYC status and gates add-funds flows; adds KYC initiation hooks and UI loading/disable states; unifies KYC result typing, removes persona navigation side-effects, invalidates user/country on KYC completion, and adds i18n and a changeset for a patch release. Changes
Sequence DiagramsequenceDiagram
participant User
participant AddFunds as AddFunds Component
participant KYCQuery as KYC Status Query
participant BeginKYC as useBeginKYC Hook
participant Persona as persona.startKYC()
participant Cache as Query Cache
participant Ramp as Ramp Providers Query
User->>AddFunds: Open add-funds / select option
AddFunds->>KYCQuery: Read ["kyc","status"]
alt KYC approved
AddFunds->>AddFunds: Navigate to chosen flow (fiat/crypto)
else KYC not approved
AddFunds->>BeginKYC: Call mutate() / mutateAsync()
BeginKYC->>Persona: startKYC()
Persona->>Persona: External KYC flow (complete / cancel / error)
Persona->>Cache: Invalidate ["kyc","status"]
Persona->>Cache: Invalidate ["user","country"] on complete
Persona-->>BeginKYC: Resolve with KYCResult
BeginKYC-->>AddFunds: Promise settles
AddFunds->>Ramp: Invalidate / refetch ramp providers (if applicable)
AddFunds->>AddFunds: Proceed to flow unless cancelled
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #941 +/- ##
==========================================
- Coverage 71.69% 71.68% -0.01%
==========================================
Files 228 228
Lines 8277 8279 +2
Branches 2661 2663 +2
==========================================
+ Hits 5934 5935 +1
- Misses 2113 2115 +2
+ Partials 230 229 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
♻️ Duplicate comments (2)
src/components/getting-started/GettingStarted.tsx (1)
152-157: 🧹 Nitpick | 🔵 TrivialClarify the navigation condition for explicitness.
The basic KYC flow rejects (rather than resolves) on error, so
result?.status !== "cancel"effectively meansresult?.status === "complete". However, making this explicit improves readability and guards against future changes to the error handling pattern.💡 Suggested clarification
beginKYC .mutateAsync() .then((result) => { - if (result?.status !== "cancel") router.replace("/(main)/(home)"); + if (!result || result.status === "complete") router.replace("/(main)/(home)"); }) .catch(() => {}); // eslint-disable-line `@typescript-eslint/no-empty-function` -- error handled by useBeginKYCsrc/components/add-funds/AddFunds.tsx (1)
209-213:⚠️ Potential issue | 🟡 MinorConsider showing a loading state while
countryCodeis unresolved.When
countryCodeis falsy (empty string or undefined), neither the skeleton nor the providers content renders, leaving a blank content area. This can occur during the initialcountryCodefetch or on direct navigation to the fiat URL.You could destructure
isLoadingfrom thecountryCodequery and show a skeleton while it resolves:- const { data: countryCode } = useQuery({ + const { data: countryCode, isLoading: isCountryLoading } = useQuery({Then update the fiat skeleton condition:
- {type === "fiat" && countryCode && isPending && ( + {type === "fiat" && (isCountryLoading || (countryCode && isPending)) && (
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4b9b1a08-1801-4366-98bc-f6d2748ac4a0
📒 Files selected for processing (10)
.changeset/stale-teams-say.mdcspell.jsonsrc/components/add-funds/AddFunds.tsxsrc/components/add-funds/AddFundsOption.tsxsrc/components/getting-started/GettingStarted.tsxsrc/i18n/es-AR.jsonsrc/i18n/es.jsonsrc/i18n/pt.jsonsrc/utils/persona.tssrc/utils/useBeginKYC.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c259fdadf9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Summary by CodeRabbit
New Features
Improvements
Localization
Chores