diff --git a/react/lib/components/Widget/WidgetContainer.tsx b/react/lib/components/Widget/WidgetContainer.tsx index 18615cfb..5bd1293c 100644 --- a/react/lib/components/Widget/WidgetContainer.tsx +++ b/react/lib/components/Widget/WidgetContainer.tsx @@ -220,7 +220,16 @@ export const WidgetContainer: React.FunctionComponent = setSuccess(true); onSuccess?.(transaction); } else { - onTransaction?.(transaction); + // FIXME: Since the confirmed transactions are supported this could + // be called twice for the same transaction. In order to maintain + // the same behavior as before the confirmed transactions are + // supported we should only call onTransaction if the transaction is + // not confirmed. The proper fix would be to add a status so the + // callback know why it's called (added to mempool, finalized, + // confirmed, etc.). Fabien 2026-02-20 + if (transaction.confirmed === false) { + onTransaction?.(transaction); + } if (transactionText){ enqueueSnackbar( `${ @@ -275,14 +284,15 @@ export const WidgetContainer: React.FunctionComponent = const handleNewTransaction = useCallback( (tx: Transaction) => { - if ( - tx.confirmed === false && - isGreaterThanZero(resolveNumber(tx.amount)) - ) { + if (success) { + return; + } + + if (isGreaterThanZero(resolveNumber(tx.amount))) { handlePayment(tx); } }, - [handlePayment], + [handlePayment, success], ); const checkForTransactions = useCallback(async (): Promise => { diff --git a/react/lib/util/chronik.ts b/react/lib/util/chronik.ts index 7714d257..38ff42ae 100644 --- a/react/lib/util/chronik.ts +++ b/react/lib/util/chronik.ts @@ -249,7 +249,8 @@ export const parseWebsocketMessage = async ( } const { msgType } = wsMsg; switch (msgType) { - case 'TX_ADDED_TO_MEMPOOL': { + case 'TX_ADDED_TO_MEMPOOL': + case 'TX_CONFIRMED': { const rawTransaction = await chronik.tx(wsMsg.txid); const transaction = await getTransactionFromChronikTransaction(rawTransaction, address ?? '')