From 6d7657aeb969f9b3b01a862b226cbee100d0bf9f Mon Sep 17 00:00:00 2001 From: umsangdon Date: Wed, 28 Oct 2026 18:17:56 +0900 Subject: [PATCH] =?UTF-8?q?fix(=EA=B3=B5=EC=9A=A9):=20=EB=96=A0=EB=82=A8?= =?UTF-8?q?=20[=EC=B7=A8=EC=86=8C]=20=EB=92=A4=20=EB=8B=A8=EA=B3=84=20[<]?= =?UTF-8?q?=20[>]=20=ED=9D=90=EB=A0=A4=EC=A7=90=20=E2=80=94=20=EC=A3=BC?= =?UTF-8?q?=EC=86=8C=20=EB=90=98=EB=8F=8C=EB=A6=BC=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?(PLAN=20572)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - main.ts 취소 갈래 = replaceState 뒤 aislo:route-restored 냄(hashchange 가 안 뜸) - ui_template_help [<] [>] sync 가 그 알림에도 다시 맞춤 · 화면에서 빠지면 둘 다 풂 - test_401 소스 대조 하나 더함 Co-Authored-By: Claude Opus 5.5 --- A00_Common/main.ts | 2 ++ resources/tester/test_401_project_isolation.py | 8 ++++++++ ui_template/ui_template_help.ts | 10 +++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/A00_Common/main.ts b/A00_Common/main.ts index 647de8f24..cd89db516 100644 --- a/A00_Common/main.ts +++ b/A00_Common/main.ts @@ -19,6 +19,7 @@ import { releaseSelectAfterPick, } from "@ui/ui_template_native_menu"; import { initLoupe, LOUPE_ROUTE } from "@ui/ui_template_loupe"; +import { ROUTE_RESTORED_EVENT } from "@ui/ui_template_help"; import { ROUTES, type RoutePath } from "@config/config_frontend"; import { initThemeAndLang, injectShellStyles, renderShell } from "./app_shell"; import { @@ -95,6 +96,7 @@ function bootstrap(): void { renderAll(); } else { history.replaceState(null, "", shownHash); // 취소 — 머문 채 주소만 되돌림 + window.dispatchEvent(new Event(ROUTE_RESTORED_EVENT)); // 주소 따라 그린 것(단계 [<] [>])을 다시 맞춤 } }); }); diff --git a/resources/tester/test_401_project_isolation.py b/resources/tester/test_401_project_isolation.py index fb8a5f388..d6b34f811 100644 --- a/resources/tester/test_401_project_isolation.py +++ b/resources/tester/test_401_project_isolation.py @@ -110,3 +110,11 @@ def test_공용이_도우미를_씀(): for name in ("d02-points", "e02-ground", "e03-prob", "e04-settings", "e05-report"): assert f'"{name}": {{ bucket: "draft", scope: "project"' in state assert '"e06-rock"' in state and '"e07-settings"' in state + + +def test_떠남_취소_뒤_단계_단추_다시_맞춤(): + # [취소] = 주소만 되돌림(hashchange 없음) → 「되돌림」 알림으로 [<] [>] 다시 맞춤 + main = (ROOT / "A00_Common/main.ts").read_text(encoding="utf-8") + assert "window.dispatchEvent(new Event(ROUTE_RESTORED_EVENT))" in main + help_ts = (ROOT / "ui_template/ui_template_help.ts").read_text(encoding="utf-8") + assert "window.addEventListener(ROUTE_RESTORED_EVENT, onHash);" in help_ts diff --git a/ui_template/ui_template_help.ts b/ui_template/ui_template_help.ts index fdc0de27d..bdacf8f0c 100644 --- a/ui_template/ui_template_help.ts +++ b/ui_template/ui_template_help.ts @@ -344,6 +344,9 @@ function createStepNavButton(step: -1 | 1): HTMLButtonElement { return button; } +/** 떠남 [취소] 뒤 주소를 되돌렸다는 알림(`main.ts` 가 냄 · hashchange 가 안 뜸). */ +export const ROUTE_RESTORED_EVENT = "aislo:route-restored"; + /** 지금 주소의 묶음 · [<] [>] 차례 — 목록 밖이면 차례 -1 */ function stepNavIndex(): { index: number; last: number } { const route = location.hash.replace(/^#\/?/, "").split("?")[0]; @@ -364,11 +367,16 @@ export function placeHelpButton(actions: HTMLElement): void { prev.disabled = index <= 0; next.disabled = index === last; }; + // 떠남 [취소] 는 주소만 되돌림(hashchange 없음) — 「되돌림」 알림에도 다시 맞춤(572) const onHash = (): void => { if (prev.isConnected) sync(); - else window.removeEventListener("hashchange", onHash); // 화면에서 빠짐 — 풂 + else { + window.removeEventListener("hashchange", onHash); // 화면에서 빠짐 — 풂 + window.removeEventListener(ROUTE_RESTORED_EVENT, onHash); + } }; sync(); window.addEventListener("hashchange", onHash); + window.addEventListener(ROUTE_RESTORED_EVENT, onHash); row.prepend(createHelpButton(), prev, next); }