Skip to content

Commit

Permalink
fix: dApp switch banner appearing on non-injectable pages (#1713)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSinclair authored Oct 2, 2024
1 parent 4e1d07d commit 6a4d0b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ export const AppConnectionNudgeBanner = ({
</Inline>
<TextOverflow color="label" size="14pt" weight="bold">
{i18n.t('app_connection_switcher.banner.connect_to', {
appName: dappMetadata?.appName || dappMetadata?.appHost,
appName:
dappMetadata?.appName ||
dappMetadata?.appHost ||
'dApp',
})}
</TextOverflow>
</Stack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const AppConnectionWatcher = () => {
if (showNudgeSheet) setShowNudgeSheet(false);
triggerToast({
title: i18n.t('app_connection_switcher.banner.app_connected', {
appName: dappMetadata?.appName || dappMetadata?.appHostName,
appName: dappMetadata?.appName || dappMetadata?.appHostName || 'dApp',
}),
description: chainsLabel[activeSession?.chainId || ChainId.mainnet],
});
Expand Down Expand Up @@ -117,6 +117,9 @@ export const AppConnectionWatcher = () => {
clearTimeout(timeoutRef.current);
}

// Injection failed, or attempting to connect to `chrome://` url
if (url === '') return;

if (
nudgeSheetEnabled &&
!appHasInteractedWithNudgeSheet({ host: dappMetadata?.appHost })
Expand All @@ -139,6 +142,7 @@ export const AppConnectionWatcher = () => {
handleBannerTimeout,
nudgeSheetEnabled,
setAppHasInteractedWithNudgeSheet,
url,
]);

const hide = useCallback(() => {
Expand Down

0 comments on commit 6a4d0b6

Please sign in to comment.