diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 8a9a01c1..71bf9c92 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -10425,8 +10425,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.0.0.tgz", "integrity": "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/es-object-atoms": { "version": "1.1.1", diff --git a/frontend/src/app/pay/[id]/page.tsx b/frontend/src/app/pay/[id]/page.tsx index 964bf6b0..43f3a117 100644 --- a/frontend/src/app/pay/[id]/page.tsx +++ b/frontend/src/app/pay/[id]/page.tsx @@ -1,6 +1,7 @@ "use client"; import { useEffect, useRef, useState } from "react"; +import { motion } from "framer-motion"; import Image from "next/image"; import { useParams, useRouter } from "next/navigation"; import { useLocale, useTranslations } from "next-intl"; @@ -262,7 +263,10 @@ export default function PaymentPage() { useEffect(() => { if (!walletPublicKey) return; if (didWalletAccountSwitch(previousWalletPublicKey.current, walletPublicKey)) { - toast.info("Wallet account switched. Checkout balances updated."); + // Optimistic update: clear balances immediately when wallet switches + setWalletBalances([]); + setSortedSourceAssets([]); + toast.info("Wallet account switched. Updating balances..."); } previousWalletPublicKey.current = walletPublicKey; }, [walletPublicKey]); @@ -501,7 +505,13 @@ export default function PaymentPage() { {sortedSourceAssets.length > 0 && (
-
+