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}