From d6bad42854110a449a095cfa41b6c51bdd5950e0 Mon Sep 17 00:00:00 2001 From: Felix <23635466+its-felix@users.noreply.github.com> Date: Sun, 3 Nov 2024 18:13:55 +0100 Subject: [PATCH] prevent unnecessary re-renders of main layout --- ui/src/components/root.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ui/src/components/root.tsx b/ui/src/components/root.tsx index 227d2a7..9def623 100644 --- a/ui/src/components/root.tsx +++ b/ui/src/components/root.tsx @@ -125,11 +125,7 @@ export function RootLayout({ function HeaderSelectorFixAppLayout(props: AppLayoutProps) { const { headerSelector, ...appLayoutProps } = props; - const [key, setKey] = useState(`a${Date.now()}-${Math.random()}`); - - useEffect(() => { - setKey(`a${Date.now()}-${Math.random()}`); - }, [headerSelector]); + const key = useMemo(() => `a${Date.now()}-${Math.random()}`, [headerSelector]); return (