From 8b926e30426078b7139b6a19211991b08b73a4b6 Mon Sep 17 00:00:00 2001 From: katspaugh Date: Mon, 20 Nov 2023 11:18:00 +0100 Subject: [PATCH] Fix: delay the notifications banner --- .../PushNotifications/PushNotificationsBanner/index.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/settings/PushNotifications/PushNotificationsBanner/index.tsx b/src/components/settings/PushNotifications/PushNotificationsBanner/index.tsx index 9bf3c4cff8..e7ae9ccbff 100644 --- a/src/components/settings/PushNotifications/PushNotificationsBanner/index.tsx +++ b/src/components/settings/PushNotifications/PushNotificationsBanner/index.tsx @@ -27,7 +27,7 @@ import type { PushNotificationPreferences } from '@/services/push-notifications/ import type { NotifiableSafes } from '../logic' import useWallet from '@/hooks/wallets/useWallet' import CircularProgress from '@mui/material/CircularProgress' - +import useDebounce from '@/hooks/useDebounce' import css from './styles.module.css' const DISMISS_PUSH_NOTIFICATIONS_KEY = 'dismissPushNotifications' @@ -119,8 +119,10 @@ export const PushNotificationsBanner = ({ children }: { children: ReactElement } const isSafeAdded = !!addedSafesOnChain?.[safeAddress] const isSafeRegistered = getPreferences(safe.chainId, safeAddress) - const shouldShowBanner = - isNotificationFeatureEnabled && !isPushNotificationBannerDismissed && isSafeAdded && !isSafeRegistered && !!wallet + const shouldShowBanner = useDebounce( + isNotificationFeatureEnabled && !isPushNotificationBannerDismissed && isSafeAdded && !isSafeRegistered && !!wallet, + 3000, + ) const { registerNotifications } = useNotificationRegistrations()