From e792d7a514497b59ff421a33a112bdf3eb664274 Mon Sep 17 00:00:00 2001 From: lissavxo Date: Tue, 22 Jul 2025 18:30:36 -0300 Subject: [PATCH] fix: newTxs context --- react/lib/components/Widget/WidgetContainer.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/react/lib/components/Widget/WidgetContainer.tsx b/react/lib/components/Widget/WidgetContainer.tsx index 4700c81f..0cee400e 100644 --- a/react/lib/components/Widget/WidgetContainer.tsx +++ b/react/lib/components/Widget/WidgetContainer.tsx @@ -131,6 +131,9 @@ export const WidgetContainer: React.FunctionComponent = const [internalCurrencyObj, setInternalCurrencyObj] = useState(); const setCurrencyObj = props.setCurrencyObj || setInternalCurrencyObj; const currencyObj = props.currencyObj || internalCurrencyObj; + const [internalNewTxs, setInternalNewTxs] = useState(); + const thisNewTxs = setNewTxs ? newTxs : internalNewTxs; + const thisSetNewTxs = setNewTxs ?? setInternalNewTxs; const [thisPaymentId, setThisPaymentId] = useState(); const [thisPrice, setThisPrice] = useState(0); @@ -214,7 +217,7 @@ export const WidgetContainer: React.FunctionComponent = } } - setNewTxs([]); + thisSetNewTxs([]); }, [ onSuccess, @@ -267,10 +270,10 @@ export const WidgetContainer: React.FunctionComponent = ); useEffect(() => { - newTxs?.map(tx => { + thisNewTxs?.map(tx => { handleNewTransaction(tx); }); - }, [newTxs, handleNewTransaction]); + }, [thisNewTxs, handleNewTransaction]); return ( @@ -294,8 +297,8 @@ export const WidgetContainer: React.FunctionComponent = success={success} disabled={disabled} editable={editable} - newTxs={newTxs} - setNewTxs={setNewTxs} + newTxs={thisNewTxs} + setNewTxs={thisSetNewTxs} txsSocket={txsSocket} wsBaseUrl={wsBaseUrl} apiBaseUrl={apiBaseUrl}