diff --git a/packages/mobile/src/screens/app-screen/AppTabsScreen.tsx b/packages/mobile/src/screens/app-screen/AppTabsScreen.tsx index a2eef519bd9..671f4085368 100644 --- a/packages/mobile/src/screens/app-screen/AppTabsScreen.tsx +++ b/packages/mobile/src/screens/app-screen/AppTabsScreen.tsx @@ -20,6 +20,7 @@ import { NotificationsTabScreen } from './NotificationsTabScreen' import type { ProfileTabScreenParamList } from './ProfileTabScreen' import type { TrendingTabScreenParamList } from './TrendingTabScreen' import { TrendingTabScreen } from './TrendingTabScreen' +import { usePrefetchNotifications } from './usePrefetchNotifications' const { getBalance } = walletActions export type AppScreenParamList = { @@ -39,6 +40,7 @@ export const AppTabsScreen = () => { const dispatch = useDispatch() const appState = useAppState() usePhantomConnect((route) => route?.params?.params?.params ?? ({} as any)) + usePrefetchNotifications() useEffect(() => { if (appState === 'active') { diff --git a/packages/mobile/src/screens/app-screen/usePrefetchNotifications.ts b/packages/mobile/src/screens/app-screen/usePrefetchNotifications.ts new file mode 100644 index 00000000000..73079a50ca8 --- /dev/null +++ b/packages/mobile/src/screens/app-screen/usePrefetchNotifications.ts @@ -0,0 +1,15 @@ +import { useEffect, useState } from 'react' + +import { useNotifications } from '@audius/common/api' + +export const usePrefetchNotifications = () => { + const [isNotificationsEnabled, setIsNotificationsEnabled] = useState(false) + useEffect(() => { + const timer = setTimeout(() => { + setIsNotificationsEnabled(true) + }, 1000) + return () => clearTimeout(timer) + }, []) + + useNotifications({ enabled: isNotificationsEnabled }) +}