about summary refs log tree commit diff
path: root/src/view/screens/Notifications.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/screens/Notifications.tsx')
-rw-r--r--src/view/screens/Notifications.tsx15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/view/screens/Notifications.tsx b/src/view/screens/Notifications.tsx
index e0f234073..970882f12 100644
--- a/src/view/screens/Notifications.tsx
+++ b/src/view/screens/Notifications.tsx
@@ -11,7 +11,6 @@ import {ViewHeader} from '../com/util/ViewHeader'
 import {Feed} from '../com/notifications/Feed'
 import {TextLink} from 'view/com/util/Link'
 import {LoadLatestBtn} from 'view/com/util/load-latest/LoadLatestBtn'
-import {useStores} from 'state/index'
 import {useOnMainScroll} from 'lib/hooks/useOnMainScroll'
 import {usePalette} from 'lib/hooks/usePalette'
 import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
@@ -21,6 +20,7 @@ import {logger} from '#/logger'
 import {useSetMinimalShellMode} from '#/state/shell'
 import {useUnreadNotifications} from '#/state/queries/notifications/unread'
 import {RQKEY as NOTIFS_RQKEY} from '#/state/queries/notifications/feed'
+import {listenSoftReset, emitSoftReset} from '#/state/events'
 
 type Props = NativeStackScreenProps<
   NotificationsTabNavigatorParams,
@@ -28,7 +28,6 @@ type Props = NativeStackScreenProps<
 >
 export const NotificationsScreen = withAuthRequired(
   function NotificationsScreenImpl({}: Props) {
-    const store = useStores()
     const setMinimalShellMode = useSetMinimalShellMode()
     const [onMainScroll, isScrolledDown, resetMainScroll] = useOnMainScroll()
     const scrollElRef = React.useRef<FlatList>(null)
@@ -57,13 +56,9 @@ export const NotificationsScreen = withAuthRequired(
       React.useCallback(() => {
         setMinimalShellMode(false)
         logger.debug('NotificationsScreen: Updating feed')
-        const softResetSub = store.onScreenSoftReset(onPressLoadLatest)
         screen('Notifications')
-
-        return () => {
-          softResetSub.remove()
-        }
-      }, [store, screen, onPressLoadLatest, setMinimalShellMode]),
+        return listenSoftReset(onPressLoadLatest)
+      }, [screen, onPressLoadLatest, setMinimalShellMode]),
     )
 
     const ListHeaderComponent = React.useCallback(() => {
@@ -100,13 +95,13 @@ export const NotificationsScreen = withAuthRequired(
                   )}
                 </>
               }
-              onPress={() => store.emitScreenSoftReset()}
+              onPress={emitSoftReset}
             />
           </View>
         )
       }
       return <></>
-    }, [isDesktop, pal, store, hasNew])
+    }, [isDesktop, pal, hasNew])
 
     return (
       <View testID="notificationsScreen" style={s.hContentRegion}>