Skip to content

Commit d16e9e2

Browse files
committed
re-initiate tx toast on success or error
1 parent fbd1457 commit d16e9e2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/internal/components/Toast.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const defaultAnimationByPosition = {
2222

2323
export function Toast({
2424
className,
25-
durationMs = 3000,
25+
durationMs = 5000,
2626
position = 'bottom-center',
2727
animation,
2828
isVisible,

src/transaction/components/TransactionToast.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useCallback } from 'react';
1+
import { useCallback, useEffect } from 'react';
22
import { Toast } from '../../internal/components/Toast';
33
import type { TransactionToastReact } from '../types';
44
import { useTransactionContext } from './TransactionProvider';
@@ -30,6 +30,12 @@ export function TransactionToast({
3030
!errorMessage &&
3131
!transactionId;
3232

33+
useEffect(() => {
34+
if (receipt || errorMessage) {
35+
setIsToastVisible(true);
36+
}
37+
}, [receipt, errorMessage, setIsToastVisible]);
38+
3339
if (!isToastVisible || isInProgress) {
3440
return null;
3541
}

0 commit comments

Comments
 (0)