Skip to content

Commit

Permalink
fix: Fix navigation guard redirection and localStorage cleanup
Browse files Browse the repository at this point in the history
- Remove incorrect redirection logic from BrowserNavigationGuard
- Move localStorage cleanup to RootLayout mount
- Clear all playerIds and shouldRedirect flags on initial load
  • Loading branch information
rhino-ty committed Nov 28, 2024
1 parent 397c436 commit 8bbfa91
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions client/src/layouts/RootLayout.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="relative min-h-screen min-w-80 bg-violet-950 bg-fixed antialiased">
<BackgroundMusicButton />
Expand Down

0 comments on commit 8bbfa91

Please sign in to comment.