Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/burn/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const metadata: Metadata = {

import React, { useState, Suspense } from "react";
import Link from "next/link";
import { useSearchParams } from "next/navigation";
import { useSearchParams, useRouter } from "next/navigation";
import { PageContainer } from "@/components/layout/page-container";
import { Card } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
Expand Down Expand Up @@ -76,6 +76,7 @@ const formatCurrency = (amount: string, currency: string) => {

function BurnPageContent() {
const opts = useApiOpts();
const router = useRouter();
const searchParams = useSearchParams();
const { userId, stellarAddress } = useAuth();
const kit = useStellarWalletsKit();
Expand Down Expand Up @@ -211,6 +212,7 @@ function BurnPageContent() {
);
setTxId(res.transaction_id);
form.reset({ ...values, acbuAmount: "" });
router.replace('/mint');
Comment on lines 213 to +215

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Major: Success message not visible to user.

After setting the transaction ID (line 213), the code immediately navigates away to /mint (line 215). This prevents the success message component (lines 247-254) from rendering, leaving users without confirmation of their burn transaction.

This creates an inconsistent experience compared to the mint flow, which displays a success dialog before returning to the input state.

Consider one of these approaches:

  1. Add a delay before navigation to let the success message display briefly
  2. Show a success dialog similar to the mint flow (requires adding dialog state)
  3. Pass txId as a query parameter to /mint and show the success message there
  4. Remove the automatic redirect and add a manual "Back to Mint" button
⏱️ Example: Add delay before navigation
       setTxId(res.transaction_id);
       form.reset({ ...values, acbuAmount: "" });
-      router.replace('/mint');
+      // Show success message briefly before navigating back
+      setTimeout(() => {
+        router.replace('/mint');
+      }, 3000);
📝 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
setTxId(res.transaction_id);
form.reset({ ...values, acbuAmount: "" });
router.replace('/mint');
setTxId(res.transaction_id);
form.reset({ ...values, acbuAmount: "" });
// Show success message briefly before navigating back
setTimeout(() => {
router.replace('/mint');
}, 3000);
🤖 Prompt for 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.

In `@app/burn/page.tsx` around lines 213 - 215, The success message never appears
because after calling setTxId(...) the code immediately calls
router.replace('/mint'), so the success dialog (which reads txId) cannot render;
update the flow to show the success UI before navigating: introduce a local
dialog state (e.g., isBurnSuccessOpen) or reuse the existing mint success dialog
pattern, open the success dialog when setTxId(...) runs, call form.reset(...) as
needed, and only call router.replace('/mint') after the user closes the dialog
(or after a short timeout if you prefer a delay), ensuring the success component
can read txId and render properly instead of being immediately redirected.

} catch (e) {
setApiError(e);
} finally {
Expand Down
2 changes: 1 addition & 1 deletion app/mint/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default function MintPage() {
setStep("confirm");
};
const handleBurnConfirm = () => {
router.push(`/burn?amount=${burnAmount}&currency=${selectedFiatCurrency}`);
router.replace(`/burn?amount=${burnAmount}&currency=${selectedFiatCurrency}`);
};
const handleExecuteMint = async () => {
if (!fiatAmount || parseFloat(fiatAmount) <= 0 || !selectedFiatCurrency)
Expand Down
Loading