일정 관리 페이지 상태 저장 수정 - 새로고침/직접 진입 시 초기화

- navigation type 체크: reload나 navigate일 때 sessionStorage 상태 제거
- 뒤로가기(back_forward)에서만 상태 복원
This commit is contained in:
caadiq 2026-01-06 12:05:39 +09:00
parent cc8fe5a8a3
commit 026c68aa52

View file

@ -21,13 +21,21 @@ function AdminSchedule() {
}; };
// sessionStorage // sessionStorage
// URL ( )
const getStoredState = () => { const getStoredState = () => {
try { try {
//
const navType = performance.getEntriesByType('navigation')[0]?.type;
if (navType === 'reload' || navType === 'navigate') {
sessionStorage.removeItem('adminScheduleState');
return null;
}
const stored = sessionStorage.getItem('adminScheduleState'); const stored = sessionStorage.getItem('adminScheduleState');
return stored ? JSON.parse(stored) : null; return stored ? JSON.parse(stored) : null;
} catch { return null; } } catch { return null; }
}; };
const storedState = getStoredState(); const storedState = getStoredState();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [user, setUser] = useState(null); const [user, setUser] = useState(null);