diff --git a/web/src/App.tsx b/web/src/App.tsx index b5065ef3..88e541f4 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -4,7 +4,7 @@ import { Toaster } from "react-hot-toast"; import { useTranslation } from "react-i18next"; import { RouterProvider } from "react-router-dom"; import router from "./router"; -import { useLocationStore, useGlobalStore } from "./store/module"; +import { useGlobalStore } from "./store/module"; import * as storage from "./helpers/storage"; import { getSystemColorScheme } from "./helpers/utils"; import Loading from "./pages/Loading"; @@ -12,17 +12,9 @@ import Loading from "./pages/Loading"; const App = () => { const { i18n } = useTranslation(); const globalStore = useGlobalStore(); - const locationStore = useLocationStore(); const { mode, setMode } = useColorScheme(); const { appearance, locale, systemStatus } = globalStore.state; - useEffect(() => { - locationStore.updateStateWithLocation(); - window.onpopstate = () => { - locationStore.updateStateWithLocation(); - }; - }, []); - useEffect(() => { const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)"); const handleColorSchemeChange = (e: MediaQueryListEvent) => { diff --git a/web/src/components/AboutSiteDialog.tsx b/web/src/components/AboutSiteDialog.tsx index aff70d12..e68d1c1a 100644 --- a/web/src/components/AboutSiteDialog.tsx +++ b/web/src/components/AboutSiteDialog.tsx @@ -26,9 +26,9 @@ const AboutSiteDialog: React.FC = ({ destroy }: Props) => { -
+

{customizedProfile.description || "No description"}

-
+ - diff --git a/web/src/components/Header.tsx b/web/src/components/Header.tsx index 80955e44..268816e3 100644 --- a/web/src/components/Header.tsx +++ b/web/src/components/Header.tsx @@ -1,5 +1,5 @@ import { useEffect } from "react"; -import { NavLink } from "react-router-dom"; +import { NavLink, useLocation } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { useLayoutStore, useUserStore } from "../store/module"; import { resolution } from "../utils/layout"; @@ -12,6 +12,7 @@ import UserBanner from "./UserBanner"; const Header = () => { const { t } = useTranslation(); + const location = useLocation(); const userStore = useUserStore(); const layoutStore = useLayoutStore(); const showHeader = layoutStore.state.showHeader; @@ -27,7 +28,7 @@ const Header = () => { }; window.addEventListener("resize", handleWindowResize); handleWindowResize(); - }, []); + }, [location]); return (
{ onClick={() => layoutStore.setHeaderStatus(false)} >
diff --git a/web/src/components/HomeSidebar.tsx b/web/src/components/HomeSidebar.tsx index 2d8704d1..cd803c19 100644 --- a/web/src/components/HomeSidebar.tsx +++ b/web/src/components/HomeSidebar.tsx @@ -5,8 +5,10 @@ import ShortcutList from "./ShortcutList"; import TagList from "./TagList"; import SearchBar from "./SearchBar"; import UsageHeatMap from "./UsageHeatMap"; +import { useLocation } from "react-router-dom"; const HomeSidebar = () => { + const location = useLocation(); const layoutStore = useLayoutStore(); const showHomeSidebar = layoutStore.state.showHomeSidebar; @@ -20,7 +22,7 @@ const HomeSidebar = () => { }; window.addEventListener("resize", handleWindowResize); handleWindowResize(); - }, []); + }, [location]); return (
{ onClick={() => layoutStore.setHomeSidebarStatus(false)} >