From fde8fa9850c6d7ce041f4052293cdf34901163ca Mon Sep 17 00:00:00 2001 From: Micaela Estabillo Date: Wed, 9 Oct 2024 11:43:45 -0700 Subject: [PATCH] squash to reset --- ui/pages/bridge/index.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ui/pages/bridge/index.tsx b/ui/pages/bridge/index.tsx index c43317361d7b..8ff78bb3210d 100644 --- a/ui/pages/bridge/index.tsx +++ b/ui/pages/bridge/index.tsx @@ -52,16 +52,11 @@ const CrossChainSwap = () => { }, [isBridgeChain, isBridgeEnabled, providerConfig]); useEffect(() => { - // Reset controller before unloading the page - const onBeforeUnload = () => { + // Reset controller and inputs before unloading the page + return () => { dispatch(resetInputFields()); dispatch(resetBridgeState()); }; - - window.addEventListener('beforeunload', onBeforeUnload); - return () => { - window.removeEventListener('beforeunload', onBeforeUnload); - }; }, []); const redirectToDefaultRoute = async () => {