diff --git a/src/Components/AppShell/NavBar.tsx b/src/Components/AppShell/NavBar.tsx index d9ad21e6..ab62cd8f 100644 --- a/src/Components/AppShell/NavBar.tsx +++ b/src/Components/AppShell/NavBar.tsx @@ -26,14 +26,16 @@ export default function NavBar({ appName}: { appName: string }) { const nameRef = useRef(null); const [nameWidth, setNameWidth] = useState(0); + const location = useLocation(); + const [showNav, setShowNav] = useState(false) + + useEffect(() => { - nameRef && setNameWidth(nameRef.current.scrollWidth) - }, [nameRef, appName]) + showNav && nameRef && setNameWidth(nameRef.current.scrollWidth) + }, [nameRef, appName, showNav]) - const location = useLocation(); - const [showNav, setShowNav] = useState(false) useEffect(() => {