diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-11-15 17:17:50 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-15 17:17:50 -0800 |
commit | 6616b2bff098ff4a5e464c175edf2446dae0cc88 (patch) | |
tree | fb314b51dd3d17b488fa2971735aa7c19176493b /src/view/com/feeds/FeedPage.tsx | |
parent | f23e9978d839322aab7304d2b6f183722e3ad4c1 (diff) | |
download | voidsky-6616b2bff098ff4a5e464c175edf2446dae0cc88.tar.zst |
Shell behaviors update (react-query refactor) (#1915)
* Move tick-every-minute into a hook/context * Move soft-reset event out of the shell model * Update soft-reset listener on new search page * Implement session-loaded and session-dropped events * Update analytics and push-notifications to use new session system
Diffstat (limited to 'src/view/com/feeds/FeedPage.tsx')
-rw-r--r-- | src/view/com/feeds/FeedPage.tsx | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/view/com/feeds/FeedPage.tsx b/src/view/com/feeds/FeedPage.tsx index 562b1c141..e7dcf09b8 100644 --- a/src/view/com/feeds/FeedPage.tsx +++ b/src/view/com/feeds/FeedPage.tsx @@ -14,7 +14,6 @@ import {ComposeIcon2} from 'lib/icons' import {colors, s} from 'lib/styles' import React from 'react' import {FlatList, View, useWindowDimensions} from 'react-native' -import {useStores} from 'state/index' import {Feed} from '../posts/Feed' import {TextLink} from '../util/Link' import {FAB} from '../util/fab/FAB' @@ -23,6 +22,7 @@ import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useSession} from '#/state/session' import {useComposerControls} from '#/state/shell/composer' +import {listenSoftReset, emitSoftReset} from '#/state/events' const POLL_FREQ = 30e3 // 30sec @@ -41,7 +41,6 @@ export function FeedPage({ renderEmptyState: () => JSX.Element renderEndOfFeed?: () => JSX.Element }) { - const store = useStores() const {isSandbox} = useSession() const pal = usePalette('default') const {_} = useLingui() @@ -73,12 +72,9 @@ export function FeedPage({ if (!isPageFocused || !isScreenFocused) { return } - const softResetSub = store.onScreenSoftReset(onSoftReset) screen('Feed') - return () => { - softResetSub.remove() - } - }, [store, onSoftReset, screen, feed, isPageFocused, isScreenFocused]) + return listenSoftReset(onSoftReset) + }, [onSoftReset, screen, isPageFocused, isScreenFocused]) const onPressCompose = React.useCallback(() => { track('HomeScreen:PressCompose') @@ -125,7 +121,7 @@ export function FeedPage({ )} </> } - onPress={() => store.emitScreenSoftReset()} + onPress={emitSoftReset} /> <TextLink type="title-lg" @@ -144,16 +140,7 @@ export function FeedPage({ ) } return <></> - }, [ - isDesktop, - pal.view, - pal.text, - pal.textLight, - store, - hasNew, - _, - isSandbox, - ]) + }, [isDesktop, pal.view, pal.text, pal.textLight, hasNew, _, isSandbox]) return ( <View testID={testID} style={s.h100pct}> |