From 31f15fe20b0cf59514388ecf5406499e07149587 Mon Sep 17 00:00:00 2001 From: caadiq Date: Tue, 6 Jan 2026 12:08:58 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=BC=EC=A0=95=20=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=20=EB=B3=B5=EC=9B=90=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20-=20back=5Fforward=20=ED=83=80=EC=9E=85?= =?UTF-8?q?=EC=9D=BC=20=EB=95=8C=EB=A7=8C=20=EB=B3=B5=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 뒤로가기/앞으로가기: 상태 복원 - 새로고침(reload), 직접 진입(navigate): 상태 초기화 --- frontend/src/pages/pc/admin/AdminSchedule.jsx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/frontend/src/pages/pc/admin/AdminSchedule.jsx b/frontend/src/pages/pc/admin/AdminSchedule.jsx index 0e8dbb4..7dc5c6f 100644 --- a/frontend/src/pages/pc/admin/AdminSchedule.jsx +++ b/frontend/src/pages/pc/admin/AdminSchedule.jsx @@ -21,19 +21,18 @@ function AdminSchedule() { }; // sessionStorage에서 저장된 상태 복원 - // 일정 추가/수정 후 돌아올 때만 복원 (scheduleToast가 있을 때) - // 새로고침이나 메뉴에서 직접 진입 시에는 초기화 + // 뒤로가기로 돌아올 때만 복원, 새로고침이나 직접 진입 시에는 초기화 const getStoredState = () => { try { - // scheduleToast가 있으면 일정 폼에서 돌아온 것 -> 상태 유지 - const hasScheduleToast = sessionStorage.getItem('scheduleToast'); - if (!hasScheduleToast) { - // 일정 폼에서 돌아온 게 아니면 상태 초기화 - sessionStorage.removeItem('adminScheduleState'); - return null; + const navType = performance.getEntriesByType('navigation')[0]?.type; + // 뒤로가기/앞으로가기일 때만 상태 복원 + if (navType === 'back_forward') { + const stored = sessionStorage.getItem('adminScheduleState'); + return stored ? JSON.parse(stored) : null; } - const stored = sessionStorage.getItem('adminScheduleState'); - return stored ? JSON.parse(stored) : null; + // 그 외(reload, navigate)는 상태 초기화 + sessionStorage.removeItem('adminScheduleState'); + return null; } catch { return null; } }; const storedState = getStoredState();