Skip to content

Commit

Permalink
Small bridge txn fixes (#1442)
Browse files Browse the repository at this point in the history
Co-authored-by: Zach Couchman <[email protected]>
  • Loading branch information
ZacharyCouchman and ZacharyCouchman authored Feb 5, 2024
1 parent bb38b0d commit dee3bcb
Showing 1 changed file with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,31 @@ export function Transactions({ onBackButtonClick }: TransactionsProps) {
return client.getTransactions({ txType: TransactionType.BRIDGE, fromAddress: address });
}, []);

const handleBackButtonClick = () => {
if (from) {
bridgeDispatch({
payload: {
type: BridgeActions.SET_WALLETS_AND_NETWORKS,
from: {
web3Provider: from?.web3Provider,
walletAddress: from?.walletAddress,
network: from?.network,
},
to: null,
},
});
bridgeDispatch({
payload: {
type: BridgeActions.SET_TOKEN_AND_AMOUNT,
token: null,
amount: '',
},
});
}

onBackButtonClick();
};

const fetchData = useCallback(async () => {
if (!from?.walletAddress) return undefined;

Expand Down Expand Up @@ -281,7 +306,7 @@ export function Transactions({ onBackButtonClick }: TransactionsProps) {

setLoading(false);
})();
}, [from?.walletAddress, checkout]);
}, [from, checkout]);

useEffect(() => {
page({
Expand All @@ -296,7 +321,7 @@ export function Transactions({ onBackButtonClick }: TransactionsProps) {
header={(
<HeaderNavigation
showBack
onBackButtonClick={onBackButtonClick}
onBackButtonClick={handleBackButtonClick}
title={t('views.TRANSACTIONS.layoutHeading')}
onCloseButtonClick={() => sendBridgeWidgetCloseEvent(eventTarget)}
/>
Expand Down

0 comments on commit dee3bcb

Please sign in to comment.