From f3f324be89125ca133cbfe84f91818a0d86c21a9 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Wed, 4 Sep 2024 17:18:41 +0200 Subject: [PATCH] Don't update pathPrefix in settings on every App render Signed-off-by: Julius Volz --- web/ui/mantine-ui/src/App.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/ui/mantine-ui/src/App.tsx b/web/ui/mantine-ui/src/App.tsx index 2ca61761f..3197cc2c6 100644 --- a/web/ui/mantine-ui/src/App.tsx +++ b/web/ui/mantine-ui/src/App.tsx @@ -52,7 +52,7 @@ import TSDBStatusPage from "./pages/TSDBStatusPage"; import FlagsPage from "./pages/FlagsPage"; import ConfigPage from "./pages/ConfigPage"; import AgentPage from "./pages/AgentPage"; -import { Suspense } from "react"; +import { Suspense, useEffect } from "react"; import ErrorBoundary from "./components/ErrorBoundary"; import { ThemeSelector } from "./components/ThemeSelector"; import { Notifications } from "@mantine/notifications"; @@ -192,7 +192,10 @@ function App() { const pathPrefix = getPathPrefix(window.location.pathname); const dispatch = useAppDispatch(); - dispatch(updateSettings({ pathPrefix })); + + useEffect(() => { + dispatch(updateSettings({ pathPrefix })); + }, [pathPrefix]); const { agentMode } = useSettings();