Skip to content

SENDLINKRETRY#1358

Merged
jjramirezn merged 1 commit intopeanut-wallet-devfrom
fix/SENDLINKRETRY
Oct 23, 2025
Merged

SENDLINKRETRY#1358
jjramirezn merged 1 commit intopeanut-wallet-devfrom
fix/SENDLINKRETRY

Conversation

@Hugo0
Copy link
Contributor

@Hugo0 Hugo0 commented Oct 23, 2025

No description provided.

@vercel
Copy link

vercel bot commented Oct 23, 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 23, 2025 3:59pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 23, 2025

Walkthrough

This PR enhances error handling and retry UX in the claim link flow by introducing manual retry capability with deferred NOT_FOUND errors, creating a unified ClaimErrorView component, expanding loading messaging based on retry counts, and adding configurability to the ValidationErrorView component.

Changes

Cohort / File(s) Summary
Retry and Error Handling Enhancement
src/components/Claim/Claim.tsx
Introduced manual retry UX with refetch and failureCount tracking. Deferred NOT_FOUND error display until after 4 failed retries. Expanded loading UI with contextual messages. Replaced WrongPasswordClaimLink and NotFoundClaimLink with unified ClaimErrorView component. Removed guest SupportCTA.
New Error View Component
src/components/Claim/Generic/ClaimError.view.tsx, src/components/Claim/Generic/index.ts
Created ClaimErrorView component for unified error UI with title, message, configurable primary action, support contact, and home link. Added public export in Generic index.
Supporting Updates
src/components/Claim/Generic/NotFound.view.tsx, src/components/Payment/Views/Error.validation.view.tsx
Updated NotFound message text. Added optional supportButtonText prop to ValidationErrorView with default value "Talk to support" for button label configurability.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • jjramirezn
  • Zishan-7

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning No pull request description was provided by the author. Although this is a lenient check, an empty or absent description fails to meet the basic requirement of being "related in some way to the changeset." Without any description, there is no information to evaluate regarding the intent, motivation, or context for these changes, even though the changeset itself is substantial and involves multiple files with meaningful modifications.
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.
Title Check ❓ Inconclusive The title "SENDLINKRETRY" is formatted as an abbreviation or ticket name in all caps rather than as a descriptive sentence. While it does relate to the core changeset—specifically the retry functionality added to the sendLink fetch flow—the abbreviated format and lack of proper sentence structure make it unclear whether it would effectively communicate the primary change to a teammate scanning the repository history. The title conveys specific information about the changeset but falls short of being a clear, descriptive summary that follows standard PR title conventions.
✨ 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/SENDLINKRETRY

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 23, 2025
@jjramirezn jjramirezn merged commit 69280f8 into peanut-wallet-dev Oct 23, 2025
3 of 5 checks passed
@jjramirezn jjramirezn deleted the fix/SENDLINKRETRY branch October 23, 2025 16:03
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: 1

🧹 Nitpick comments (2)
src/components/Claim/Generic/ClaimError.view.tsx (1)

9-14: Consider exporting ClaimErrorViewProps for reusability.

The type is currently private to this module. If other components need to reference or extend these props, exporting the type would improve maintainability.

src/components/Claim/Claim.tsx (1)

295-311: Clarify comment about retry UX.

The comment on line 301 says "give user option to retry" but the code shows LOADING state during automatic retries (failureCount < 4). The manual retry button only appears after all automatic retries are exhausted (failureCount >= 4). Consider updating the comment to reflect this behavior more accurately.

-           // Don't immediately show NOT_FOUND - give user option to retry
-           // Link might have just been created
+           // Don't immediately show NOT_FOUND during automatic retries
+           // Link might have just been created; after retries exhausted, show manual retry button
            if (failureCount >= 4) {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac1636b and 0eeb32a.

📒 Files selected for processing (5)
  • src/components/Claim/Claim.tsx (7 hunks)
  • src/components/Claim/Generic/ClaimError.view.tsx (1 hunks)
  • src/components/Claim/Generic/NotFound.view.tsx (1 hunks)
  • src/components/Claim/Generic/index.ts (1 hunks)
  • src/components/Payment/Views/Error.validation.view.tsx (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-18T21:36:11.486Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#535
File: src/components/Claim/Claim.tsx:142-146
Timestamp: 2024-11-18T21:36:11.486Z
Learning: In `src/components/Claim/Claim.tsx`, external calls like token price fetching and cross-chain details retrieval are already encapsulated within existing `try...catch` blocks, so additional error handling may be unnecessary.

Applied to files:

  • src/components/Claim/Generic/ClaimError.view.tsx
  • src/components/Claim/Claim.tsx
🧬 Code graph analysis (2)
src/components/Claim/Generic/ClaimError.view.tsx (2)
src/context/SupportModalContext.tsx (1)
  • useSupportModalContext (39-45)
src/components/0_Bruddle/Button.tsx (1)
  • Button (76-267)
src/components/Claim/Claim.tsx (2)
src/components/Global/PeanutLoading/index.tsx (1)
  • PeanutLoading (4-19)
src/components/Claim/Generic/ClaimError.view.tsx (1)
  • ClaimErrorView (16-47)
⏰ 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 (6)
src/components/Payment/Views/Error.validation.view.tsx (1)

18-18: LGTM! Clean configurability enhancement.

The addition of the optional supportButtonText prop with a sensible default maintains backward compatibility while allowing customization where needed.

Also applies to: 28-28, 79-79

src/components/Claim/Generic/index.ts (1)

4-4: LGTM!

The new export properly exposes the ClaimErrorView component for use across the claim flow.

src/components/Claim/Generic/NotFound.view.tsx (1)

9-9: LGTM! Improved user guidance.

The updated message provides clearer context about potential issues and suggests retry action, aligning well with the new retry UX.

src/components/Claim/Claim.tsx (3)

83-96: LGTM! Good retry and refetch strategy.

The addition of refetch and failureCount enables manual retry, while refetchOnWindowFocus and refetchOnMount improve UX for users who switch tabs or navigate away and return.


349-365: LGTM! Progressive loading messages improve UX.

The conditional messaging provides clear feedback during extended loading:

  • Initial load: spinner only
  • Early retries (1-2): "Loading your link..."
  • Extended retries (3-4): More detailed messaging with attempt counter

The attempt counter math is correct: failureCount + 1 properly shows the current attempt number.


406-427: Good retry UX with fresh attempt sets.

Both error states provide manual retry buttons that reset the link state and call refetch(), giving users a fresh set of automatic retries. This is helpful for transient errors (network issues, newly created links, etc.).

Note: For WRONG_PASSWORD errors derived from URL params (lines 208, 232), retrying without changing the URL will reproduce the same error. This is acceptable UX since the retry is quick and users might modify the URL between attempts.

Comment on lines +30 to +33
<Button
onClick={() => {
openSupportWithMessage(`I clicked on this link but got an error: ${window.location.href}`)
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Guard window access for SSR safety.

Direct access to window.location.href can throw during server-side rendering or initial hydration in Next.js, even in client components.

Apply this diff to safely access the window object:

                <Button
                    onClick={() => {
-                       openSupportWithMessage(`I clicked on this link but got an error: ${window.location.href}`)
+                       openSupportWithMessage(`I clicked on this link but got an error: ${typeof window !== 'undefined' ? window.location.href : ''}`)
                    }}
                    size="medium"
                    shadowSize="4"
                    variant="stroke"
                    className="w-full"
                >
📝 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.

Suggested change
<Button
onClick={() => {
openSupportWithMessage(`I clicked on this link but got an error: ${window.location.href}`)
}}
<Button
onClick={() => {
openSupportWithMessage(`I clicked on this link but got an error: ${typeof window !== 'undefined' ? window.location.href : ''}`)
}}
size="medium"
shadowSize="4"
variant="stroke"
className="w-full"
>
🤖 Prompt for AI Agents
In src/components/Claim/Generic/ClaimError.view.tsx around lines 30 to 33, the
onClick handler directly reads window.location.href which can crash during
SSR/hydration; change it to use a safely-guarded value (e.g. const currentHref =
typeof window !== 'undefined' ? window.location.href : '' or compute it inside a
useEffect/handler after checking typeof window) and pass that safe currentHref
into openSupportWithMessage so the component never reads window on the server.

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