일정 관리 페이지 상태 저장 수정 - 새로고침/직접 진입 시 초기화
- navigation type 체크: reload나 navigate일 때 sessionStorage 상태 제거 - 뒤로가기(back_forward)에서만 상태 복원
This commit is contained in:
parent
cc8fe5a8a3
commit
026c68aa52
1 changed files with 8 additions and 0 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue