diff --git a/mobile-app/app/components/OceanInterface/OceanInterface.tsx b/mobile-app/app/components/OceanInterface/OceanInterface.tsx index 5202a46e1e..363e512502 100644 --- a/mobile-app/app/components/OceanInterface/OceanInterface.tsx +++ b/mobile-app/app/components/OceanInterface/OceanInterface.tsx @@ -131,6 +131,7 @@ export function OceanInterface(): JSX.Element | null { const slideAnim = useRef(new Animated.Value(0)).current; // state const [tx, setTx] = useState(transaction); + const [calledTx, setCalledTx] = useState(); const [err, setError] = useState(e?.message); const [txUrl, setTxUrl] = useState(); // evm tx state @@ -167,18 +168,23 @@ export function OceanInterface(): JSX.Element | null { }), }, ); + // store called transaction + setCalledTx((prevTx) => + prevTx !== tx?.tx.txId ? tx?.tx.txId : prevTx, + ); } catch (e) { - /* empty */ + /* empty - don't do anything even if saveTx is not called */ } }; if ( - tx !== undefined && + calledTx !== tx?.tx.txId && // to ensure that api is only called once per tx + tx?.tx.txId !== undefined && network === EnvironmentNetwork.MainNet && isSaveTxEnabled ) { saveTx(tx.tx.txId); } - }, [tx, network, isSaveTxEnabled]); + }, [tx?.tx.txId, calledTx, network, isSaveTxEnabled]); useEffect(() => { // get evm tx id and url (if any)