From 159e2a52267a00dae25e9bd34aba74d671e8cef5 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Mon, 7 Sep 2026 14:41:38 +0900 Subject: [PATCH] =?UTF-8?q?refactor(B06):=20=EB=93=B1=EB=A1=9D=ED=91=9C=20?= =?UTF-8?q?=ED=82=A4=EB=A5=BC=20=EC=93=B0=EB=8A=94=20=EC=9E=90=EB=A6=AC?= =?UTF-8?q?=EA=B0=80=20=EC=A0=80=EC=9E=A5=EC=86=8C=EB=A5=BC=20=EC=A7=81?= =?UTF-8?q?=EC=A0=91=20=EA=B3=A0=EB=A5=B4=EC=A7=80=20=EC=95=8A=EA=B2=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 오늘 같은 계통이 두 번 났음 — 키는 등록표에서 받는데 **저장소는 제 맘대로** 고르는 자리. · `rockb` — 키를 날문자열로 만들어 읽는 쪽이 늘 빈 값(`f8fafd23`) · 화면 취향 — 키는 맞았는데 저장소를 직접 골라 **절반만** 옮겨짐(`9db84d9d`) 남은 두 자리(암 경계선 저장·표시 반폭)도 `storageOf` 를 거치게 함. 지금은 둘 다 초안이라 세션이 맞지만, 통이 바뀌면 조용히 갈릴 자리였음. 그물도 넓힘(`test_session_keys_registered.py`) — 등록표 키를 쓰는 파일이 저장소를 이름으로 직접 고르면 깨짐. 고르는 곳은 `b_page_state` 하나. 앱 전역 값(`CURRENT_PROJECT_ID_KEY`)은 등록표 밖이라 제외하고 이유를 적어 둠. **훑어 보니 남은 위반 0곳.** Co-Authored-By: Claude Opus 5 (1M context) --- B06_Section/B06_Section_UI_Page.ts | 14 +++++--------- B06_Section/B06_Section_UI_Page_Persist.ts | 6 +++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/B06_Section/B06_Section_UI_Page.ts b/B06_Section/B06_Section_UI_Page.ts index 3f2f28b7..0a3f68db 100644 --- a/B06_Section/B06_Section_UI_Page.ts +++ b/B06_Section/B06_Section_UI_Page.ts @@ -1,13 +1,10 @@ import { writeCrossDesignChoice } from "./B06_Section_Cross_Design_Session"; import { CURRENT_PROJECT_ID_KEY, ROUTES } from "@config/config_frontend"; import { leaveForDashboard } from "../A00_Common/b_missing_data_guard"; -import { stateKey } from "../A00_Common/b_page_state"; +import { stateKey, storageOf } from "../A00_Common/b_page_state"; import { navigateTo } from "../A00_Common/router"; import { createButton, createInputField, showToast } from "@ui/ui_template_elements"; -import type { - StructureInstance, - StructureType, -} from "../B05_Profile/B05_Profile_Api_Structures"; +import type { StructureInstance, StructureType } from "../B05_Profile/B05_Profile_Api_Structures"; import { createWorkflowLayout } from "@ui/ui_template_workflow_layout"; import { attachCollapsible } from "@ui/ui_template_collapsible"; import { workflowSteps } from "../A00_Common/b_page_scaffold"; @@ -144,8 +141,7 @@ export async function renderB06ProfileCross(root: HTMLElement): Promise { // 「구조물 배치」 — B05와 같은 컨테이너·하단 목록 템플릿(2026-08-29 일원화). // 하단 고정 dock 도 B05와 같은 구조: [구조물 목록][구분선][액션 버튼 행]. let structureMarksSink: - | ((structures: StructureInstance[], types: StructureType[]) => void) - | null = null; + ((structures: StructureInstance[], types: StructureType[]) => void) | null = null; const structuresPanel = createB06StructuresPanel({ projectId, // 횡단도·3D 넘김값에서 고른 것이 폼에 실릴 때 좌측 패널을 펼친다(2026-09-04 사용자). @@ -533,7 +529,7 @@ export async function renderB06ProfileCross(root: HTMLElement): Promise { const width = crossHalfWidth(); if (!key || width === undefined) return; try { - window.sessionStorage.setItem(key, String(width)); + storageOf(key).setItem(key, String(width)); } catch { /* 무시 */ } @@ -712,7 +708,7 @@ export async function renderB06ProfileCross(root: HTMLElement): Promise { // 세션에 보관된 표시 반폭이 있으면 그것이 우선한다(사용자가 마지막으로 지정한 값). const sessionDisplayKey = displaySessionKey(); if (sessionDisplayKey) { - const sessionDisplay = Number(window.sessionStorage.getItem(sessionDisplayKey)); + const sessionDisplay = Number(storageOf(sessionDisplayKey).getItem(sessionDisplayKey)); if (Number.isFinite(sessionDisplay) && sessionDisplay > 0) crossHalfWidthField.input.value = sessionDisplay.toFixed(1); } diff --git a/B06_Section/B06_Section_UI_Page_Persist.ts b/B06_Section/B06_Section_UI_Page_Persist.ts index 5c90c6fa..ba03afb1 100644 --- a/B06_Section/B06_Section_UI_Page_Persist.ts +++ b/B06_Section/B06_Section_UI_Page_Persist.ts @@ -21,7 +21,7 @@ import { flushPendingPipes } from "../B05_Profile/B05_Profile_Api_Pipes_Draft"; import { flushPendingStructures } from "../B05_Profile/B05_Profile_Api_Structures"; import { flushUphillOverrides } from "../B05_Profile/B05_Profile_Api_Fetch"; import { buildCrossPatches, type CrossPatchSources } from "./B06_Section_UI_Page_Patches"; -import { readState } from "../A00_Common/b_page_state"; +import { readState, storageOf } from "../A00_Common/b_page_state"; import { applyStructureAreaRows, STRUCTURE_AREA_KEYS, @@ -92,7 +92,7 @@ export function createRockBoundaryStore(options: { const storageKey = sessionKey(); if (!storageKey) return; try { - window.sessionStorage.setItem(storageKey, JSON.stringify(Object.fromEntries(offsets))); + storageOf(storageKey).setItem(storageKey, JSON.stringify(Object.fromEntries(offsets))); } catch { /* 세션 저장 실패는 무시(용량 초과 등) — 값은 메모리에 유지된다. */ } @@ -105,7 +105,7 @@ export function createRockBoundaryStore(options: { const storageKey = sessionKey(); if (!storageKey) return; try { - const raw = window.sessionStorage.getItem(storageKey); + const raw = storageOf(storageKey).getItem(storageKey); if (!raw) return; const parsed = JSON.parse(raw) as Record; Object.entries(parsed).forEach(([chainage, offset]) => {