diff options
author | Hailey <me@haileyok.com> | 2024-03-12 09:46:25 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-12 09:46:25 -0700 |
commit | ee57d74765e644de49c02de1e817eee0c6ed81aa (patch) | |
tree | 06945ebe5e8f856981cbfb25c81bdfcee807e43b /src/view/shell | |
parent | b8afb935f4eafbe64e83512ec5a97bb7b38a6ecb (diff) | |
download | voidsky-ee57d74765e644de49c02de1e817eee0c6ed81aa.tar.zst |
Dedupe navigation events (push, navigate, pop, etc) (#3179)
Diffstat (limited to 'src/view/shell')
-rw-r--r-- | src/view/shell/bottom-bar/BottomBar.tsx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/view/shell/bottom-bar/BottomBar.tsx b/src/view/shell/bottom-bar/BottomBar.tsx index 1ab3334fa..115faa296 100644 --- a/src/view/shell/bottom-bar/BottomBar.tsx +++ b/src/view/shell/bottom-bar/BottomBar.tsx @@ -36,6 +36,7 @@ import {Button} from '#/view/com/util/forms/Button' import {s} from 'lib/styles' import {Logo} from '#/view/icons/Logo' import {Logotype} from '#/view/icons/Logotype' +import {useDedupe} from 'lib/hooks/useDedupe' type TabOptions = 'Home' | 'Search' | 'Notifications' | 'MyProfile' | 'Feeds' @@ -54,6 +55,7 @@ export function BottomBar({navigation}: BottomTabBarProps) { const {data: profile} = useProfileQuery({did: currentAccount?.did}) const {requestSwitchToAccount} = useLoggedOutViewControls() const closeAllActiveElements = useCloseAllActiveElements() + const dedupe = useDedupe() const showSignIn = React.useCallback(() => { closeAllActiveElements() @@ -74,12 +76,12 @@ export function BottomBar({navigation}: BottomTabBarProps) { if (tabState === TabState.InsideAtRoot) { emitSoftReset() } else if (tabState === TabState.Inside) { - navigation.dispatch(StackActions.popToTop()) + dedupe(() => navigation.dispatch(StackActions.popToTop())) } else { - navigation.navigate(`${tab}Tab`) + dedupe(() => navigation.navigate(`${tab}Tab`)) } }, - [track, navigation], + [track, navigation, dedupe], ) const onPressHome = React.useCallback(() => onPressTab('Home'), [onPressTab]) const onPressSearch = React.useCallback( |