diff options
Diffstat (limited to 'src/view/shell')
-rw-r--r-- | src/view/shell/index.tsx | 11 | ||||
-rw-r--r-- | src/view/shell/index.web.tsx | 2 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/view/shell/index.tsx b/src/view/shell/index.tsx index 5320aebfc..6b0cc6808 100644 --- a/src/view/shell/index.tsx +++ b/src/view/shell/index.tsx @@ -52,6 +52,8 @@ function ShellInner() { const canGoBack = useNavigationState(state => !isStateAtTabRoot(state)) const {hasSession, currentAccount} = useSession() const closeAnyActiveElement = useCloseAnyActiveElement() + // start undefined + const currentAccountDid = React.useRef<string | undefined>(undefined) React.useEffect(() => { let listener = {remove() {}} @@ -66,13 +68,10 @@ function ShellInner() { }, [closeAnyActiveElement]) React.useEffect(() => { - if (currentAccount) { + // only runs when did changes + if (currentAccount && currentAccountDid.current !== currentAccount.did) { + currentAccountDid.current = currentAccount.did notifications.requestPermissionsAndRegisterToken(currentAccount) - } - }, [currentAccount]) - - React.useEffect(() => { - if (currentAccount) { const unsub = notifications.registerTokenChangeHandler(currentAccount) return unsub } diff --git a/src/view/shell/index.web.tsx b/src/view/shell/index.web.tsx index 76f4f5c9b..97c065502 100644 --- a/src/view/shell/index.web.tsx +++ b/src/view/shell/index.web.tsx @@ -11,7 +11,6 @@ import {DrawerContent} from './Drawer' import {useWebMediaQueries} from '../../lib/hooks/useWebMediaQueries' import {useNavigation} from '@react-navigation/native' import {NavigationProp} from 'lib/routes/types' -import {useAuxClick} from 'lib/hooks/useAuxClick' import {t} from '@lingui/macro' import {useIsDrawerOpen, useSetDrawerOpen} from '#/state/shell' import {useCloseAllActiveElements} from '#/state/util' @@ -26,7 +25,6 @@ function ShellInner() { const closeAllActiveElements = useCloseAllActiveElements() useWebBodyScrollLock(isDrawerOpen) - useAuxClick() useEffect(() => { const unsubscribe = navigator.addListener('state', () => { |