Skip to content

fix: fixed browser back navigation (#356)#440

Closed
Emmanex01 wants to merge 2 commits into
Pi-Defi-world:devfrom
Emmanex01:fix/browser-back-navigation
Closed

fix: fixed browser back navigation (#356)#440
Emmanex01 wants to merge 2 commits into
Pi-Defi-world:devfrom
Emmanex01:fix/browser-back-navigation

Conversation

@Emmanex01
Copy link
Copy Markdown
Contributor

@Emmanex01 Emmanex01 commented May 31, 2026

Summary by CodeRabbit

  • Refactor
    • Enhanced state management and navigation throughout the mint operation flow, ensuring more reliable confirmation and completion of mint and burn transactions.
    • Enhanced state management and navigation throughout the send operation flow, ensuring more reliable confirmation and completion of transfer transactions.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Review Change Stack

Warning

Review limit reached

@Emmanex01, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 54 minutes and 41 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fcd8ac1a-b0c4-47d1-b8a5-66c114f030bc

📥 Commits

Reviewing files that changed from the base of the PR and between 2ee566a and deb0bfe.

📒 Files selected for processing (2)
  • app/mint/page.tsx
  • app/send/page.tsx
📝 Walkthrough

Walkthrough

Both MintPage and SendPage now synchronize their confirm/success dialog states with the URL step query parameter. Dialog visibility is driven by ?step=confirm and ?step=success, replacing local state management. Navigation events update the URL via router.push (for dialog open) and router.replace (for dialog close and form reset), enabling shareable dialog states and cleaner browser history navigation.

Changes

URL-Driven Dialog State Management

Layer / File(s) Summary
Mint - initialize navigation and sync URL to dialog state
app/mint/page.tsx
Added useRouter and useSearchParams hooks; introduced effect that reads step query param and syncs confirm/success dialog visibility, with confirm handlers pushing /mint?step=confirm to URL.
Mint - wire dialogs to manage URL state on open/close
app/mint/page.tsx
Confirm and success AlertDialog components updated with onOpenChange handlers that replace URL back to /mint when closed; cancel buttons now update both step state and URL.
Mint - success navigation and form reset
app/mint/page.tsx
Mint and burn operation handlers navigate to /mint?step=success via router.replace after execution; form reset clears URL back to /mint.
Send - initialize navigation and sync URL to dialog state
app/send/page.tsx
Added useRouter and useSearchParams hooks; effect syncs step query param to dialog visibility with helper functions (openConfirmDialog, closeConfirmDialog, openSuccessDialog) to manage URL transitions.
Send - wire dialogs and update dialog triggers
app/send/page.tsx
Confirm and success AlertDialog updated with onOpenChange handlers that replace URL on close; continue button calls openConfirmDialog(); success completion calls openSuccessDialog(); confirm dialog buttons use dedicated handlers respecting sending state.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A mint and send, both now align,
Their steps enshrined in queries fine,
With router.push they dance and sway,
URL history saves the day,
No broken back—just forward flight! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: fixed browser back navigation (#356)' clearly summarizes the main change—fixing browser back navigation issues—and directly relates to the primary objective of the changeset.
Linked Issues check ✅ Passed Both modified files (app/mint/page.tsx and app/send/page.tsx) now use URL-based state management (useSearchParams, useRouter) to control multi-step dialog flows, ensuring the browser history stack is properly maintained so back() returns to the originating page rather than intermediate steps.
Out of Scope Changes check ✅ Passed All changes in both files are directly related to fixing browser back navigation by implementing URL-synchronized state management for multi-step flows, with no extraneous modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/send/page.tsx`:
- Around line 122-125: The success modal is being hidden without clearing the
?step=success URL param and the existing helper closeSuccessDialog is unused;
update all places that currently call setShowSuccessDialog(false) directly
(including the handlers that hide the success modal) to call closeSuccessDialog
instead, and ensure closeSuccessDialog performs both setShowSuccessDialog(false)
and router.replace("/send", { scroll: false }) so the UI state and URL stay in
sync.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ccf3d449-f252-44e5-839b-fec3a18a7fcc

📥 Commits

Reviewing files that changed from the base of the PR and between 5041fcb and 2ee566a.

📒 Files selected for processing (2)
  • app/mint/page.tsx
  • app/send/page.tsx

Comment thread app/send/page.tsx
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 31, 2026

@Emmanex01 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Emmanex01 Emmanex01 closed this May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

back() navigation breaks after multi-step flow – T

1 participant