diff --git a/app/assets/javascripts/components/Navigation.tsx b/app/assets/javascripts/components/Navigation.tsx index d6694876bae..757356f602a 100644 --- a/app/assets/javascripts/components/Navigation.tsx +++ b/app/assets/javascripts/components/Navigation.tsx @@ -12,7 +12,7 @@ import { PANEL_NAME_NAVIGATION } from '@/views/constants'; import { PrefKey } from '@standardnotes/snjs'; import { observer } from 'mobx-react-lite'; import { FunctionComponent } from 'preact'; -import { useCallback, useEffect, useMemo, useState } from 'preact/hooks'; +import { useCallback, useMemo, useState } from 'preact/hooks'; import { PremiumModalProvider } from './Premium'; type Props = { @@ -25,14 +25,14 @@ export const Navigation: FunctionComponent = observer( const componentViewer = appState.foldersComponentViewer; const enableNativeSmartTagsFeature = appState.features.enableNativeSmartTagsFeature; - const [panelRef, setPanelRef] = useState(null); + const [panelRef, setPanelRef_] = useState(null); - useEffect(() => { + const setPanelRef = useCallback(() => { const elem = document.querySelector( 'navigation' ) as HTMLDivElement | null; - setPanelRef(elem); - }, [setPanelRef]); + setPanelRef_(elem); + }, [setPanelRef_]); const onCreateNewTag = useCallback(() => { appState.tags.createNewTemplate(); @@ -53,10 +53,10 @@ export const Navigation: FunctionComponent = observer( return (
{componentViewer ? (
@@ -69,8 +69,8 @@ export const Navigation: FunctionComponent = observer(
) : ( -
-
+