From ed8dea5b32bf0ab932ea64a10627038551d2393c Mon Sep 17 00:00:00 2001 From: Anton Tranelis Date: Wed, 5 Jun 2024 22:53:36 +0200 Subject: [PATCH] fixed embedded mode --- src/Components/AppShell/NavBar.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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(() => {