일정 관리 상태 복원 로직 수정 - back_forward 타입일 때만 복원

- 뒤로가기/앞으로가기: 상태 복원
- 새로고침(reload), 직접 진입(navigate): 상태 초기화
This commit is contained in:
caadiq 2026-01-06 12:08:58 +09:00
parent a3573ec990
commit 31f15fe20b

View file

@ -21,19 +21,18 @@ function AdminSchedule() {
}; };
// sessionStorage // sessionStorage
// / (scheduleToast ) // ,
//
const getStoredState = () => { const getStoredState = () => {
try { try {
// scheduleToast -> const navType = performance.getEntriesByType('navigation')[0]?.type;
const hasScheduleToast = sessionStorage.getItem('scheduleToast'); // /
if (!hasScheduleToast) { if (navType === 'back_forward') {
//
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;
}
// (reload, navigate)
sessionStorage.removeItem('adminScheduleState');
return null;
} catch { return null; } } catch { return null; }
}; };
const storedState = getStoredState(); const storedState = getStoredState();