From 8bbfa91e85416368303dab67e18bcc6f49e59720 Mon Sep 17 00:00:00 2001 From: rhino-ty Date: Thu, 28 Nov 2024 17:40:46 +0900 Subject: [PATCH] fix: Fix navigation guard redirection and localStorage cleanup - Remove incorrect redirection logic from BrowserNavigationGuard - Move localStorage cleanup to RootLayout mount - Clear all playerIds and shouldRedirect flags on initial load --- client/src/layouts/RootLayout.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/src/layouts/RootLayout.tsx b/client/src/layouts/RootLayout.tsx index 9cb65489..cc184b5a 100644 --- a/client/src/layouts/RootLayout.tsx +++ b/client/src/layouts/RootLayout.tsx @@ -1,9 +1,17 @@ +import { useEffect } from 'react'; import { Outlet } from 'react-router-dom'; import helpIcon from '@/assets/help-icon.svg'; import BackgroundMusicButton from '@/components/bgm-button/BackgroundMusicButton'; import { Button } from '@/components/ui/Button'; +import { playerIdStorageUtils } from '@/utils/playerIdStorage'; const RootLayout = () => { + // 레이아웃 마운트 시 localStorage 초기화 + useEffect(() => { + playerIdStorageUtils.removeAllPlayerIds(); + localStorage.removeItem('shouldRedirect'); + }, []); + return (