diff --git a/.changeset/rude-lizards-give.md b/.changeset/rude-lizards-give.md new file mode 100644 index 000000000..94bc5e24f --- /dev/null +++ b/.changeset/rude-lizards-give.md @@ -0,0 +1,5 @@ +--- +"fuels-wallet": patch +--- + +Fixed bridge link in transaction bridge opening twice diff --git a/packages/app/src/systems/Transaction/hooks/useBridgeLink.tsx b/packages/app/src/systems/Transaction/hooks/useBridgeLink.tsx index 0c58a171a..a6134dcfa 100644 --- a/packages/app/src/systems/Transaction/hooks/useBridgeLink.tsx +++ b/packages/app/src/systems/Transaction/hooks/useBridgeLink.tsx @@ -1,4 +1,4 @@ -import { useCallback, useMemo } from 'react'; +import { type MouseEvent, useCallback, useMemo } from 'react'; import { IS_CRX } from '~/config'; import { openTab } from '~/systems/CRX/utils'; import { urlJoin } from '~/systems/Core'; @@ -11,14 +11,14 @@ export function useBridgeLink() { return urlJoin(selectedNetwork.bridgeUrl, '/history'); }, [selectedNetwork]); - const openBridge = useCallback(() => { - if (!href) return; - if (IS_CRX) { - openTab(href); - } else { + const openBridge = useCallback( + (e?: MouseEvent) => { + if (!href || IS_CRX) return; + e?.preventDefault(); window.location.href = href; - } - }, [href]); + }, + [href] + ); return { href, diff --git a/packages/app/src/systems/Transaction/pages/ViewActivity/ViewActivity.tsx b/packages/app/src/systems/Transaction/pages/ViewActivity/ViewActivity.tsx index 0720e9a6e..3ccf962fc 100644 --- a/packages/app/src/systems/Transaction/pages/ViewActivity/ViewActivity.tsx +++ b/packages/app/src/systems/Transaction/pages/ViewActivity/ViewActivity.tsx @@ -3,6 +3,7 @@ import { Alert, Box, Button, Icon, Link, Text } from '@fuel-ui/react'; import { AnimatePresence, motion } from 'framer-motion'; import { Address } from 'fuels'; import { useNavigate } from 'react-router-dom'; +import { IS_CRX } from '~/config'; import { useAccounts } from '~/systems/Account'; import { Layout, Pages, animations } from '~/systems/Core'; import { useNetworks } from '~/systems/Network'; @@ -27,7 +28,7 @@ export function ViewActivity() { address, }); const { selectedNetwork } = useNetworks(); - const { openBridge } = useBridgeLink(); + const { openBridge, href } = useBridgeLink(); return ( @@ -38,7 +39,13 @@ export function ViewActivity() { Bridge transactions are not shown in Fuel Wallet.{' '} - openBridge()}>Go to the bridge + + Go to the bridge + )}