From 4aeaa9442b0d21513b812e9a28d95d34556d2e24 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Tue, 20 Oct 2026 11:14:00 +0900 Subject: [PATCH] =?UTF-8?q?fix(493-5=20[=EC=A0=81=EC=9A=A9]=20=EB=92=A4=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=20=EC=B4=88=EC=95=88=20=3D=20=EC=83=88=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=EA=B0=92):=20=EC=B6=94=EC=B2=9C=20[=EC=A0=81?= =?UTF-8?q?=EC=9A=A9]=20=EB=92=A4=20=EC=B6=94=EA=B0=80=20=EC=B8=A1?= =?UTF-8?q?=EC=A0=90=20=EC=A0=80=EC=9E=A5=EB=B6=84=20=EB=8B=A4=EC=8B=9C=20?= =?UTF-8?q?=EB=B0=9B=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 원인: 페이지를 다시 세워도 추가 측점 저장분 기억(모듈 캐시 · 따라감 기억)이 남아 [적용]으로 지운 측점을 목록 · [저장]에 되살림 - reloadSavedPlusStations — 저장분 · 땅 위 자리 · 받음 표시 · 따라감 기억 비우고 다시 받음 · saveRecommendedRoute 가 clearDrafts 뒤 · 다시 세우기 앞에서 부름 - 시험: test_283_route_reset_confirm 에 [적용] 뒤 저장분 = 서버(0) · [저장] 본문 없음 · 대조(다시 안 받으면 옛 저장분) · 배선 차례 Co-Authored-By: Claude Opus 5.5 --- B05_Profile/B05_Profile_Api_PlusStations.ts | 9 ++++++ B05_Profile/B05_Profile_UI_RouteEdit_Apply.ts | 2 ++ .../tester/helper_283_route_reset_confirm.cjs | 32 +++++++++++++++++++ .../tester/test_283_route_reset_confirm.py | 23 ++++++++++++- 4 files changed, 65 insertions(+), 1 deletion(-) diff --git a/B05_Profile/B05_Profile_Api_PlusStations.ts b/B05_Profile/B05_Profile_Api_PlusStations.ts index fda1197fa..2a2093345 100644 --- a/B05_Profile/B05_Profile_Api_PlusStations.ts +++ b/B05_Profile/B05_Profile_Api_PlusStations.ts @@ -158,3 +158,12 @@ export function plusStationsPart(projectId: string): SavePart { }, }; } + +/** 저장분을 다시 받음 — 추천 [적용] 뒤(서버가 추가 측점을 지움) 옛 저장분 · 따라감 기억이 남지 않게(493-5). */ +export async function reloadSavedPlusStations(projectId: string): Promise { + [saved, savedRows, loaded, beforeRoute, followedOnly, warnedOutside].forEach((map) => + map.delete(projectId), + ); + await loadSavedPlusStations(projectId); + notify(projectId); +} diff --git a/B05_Profile/B05_Profile_UI_RouteEdit_Apply.ts b/B05_Profile/B05_Profile_UI_RouteEdit_Apply.ts index a3b287f19..b43a99946 100644 --- a/B05_Profile/B05_Profile_UI_RouteEdit_Apply.ts +++ b/B05_Profile/B05_Profile_UI_RouteEdit_Apply.ts @@ -30,6 +30,7 @@ import { import { balloonOffsetsPayload } from "@util/common_util_mass_haul_balance_view"; import type { SavePart } from "../A00_Common/design/design_save_api"; import { clearRouteLatestCache } from "./B05_Profile_Api_Fetch"; +import { reloadSavedPlusStations } from "./B05_Profile_Api_PlusStations"; import { replanRoute, type RouteReplanResponse, @@ -216,6 +217,7 @@ export async function saveRecommendedRoute( as_initial: true, }); clearDrafts(projectId); + await reloadSavedPlusStations(projectId); // 페이지를 다시 세워도 남는 옛 저장분(493-5) sources.get(projectId)?.saved(); const reset = routeResetNotice(saved.route_reset, saved.pipes?.crossing ?? 0); showToast(`추천 노선을 저장했습니다 — 새 초기값입니다.${reset ? ` ${reset}` : ""}`, "success"); diff --git a/resources/tester/helper_283_route_reset_confirm.cjs b/resources/tester/helper_283_route_reset_confirm.cjs index 3d90a1aa8..44629461d 100644 --- a/resources/tester/helper_283_route_reset_confirm.cjs +++ b/resources/tester/helper_283_route_reset_confirm.cjs @@ -39,13 +39,45 @@ async function applyText(server) { return ui.applyResetText("p"); } +/** 493-5 — 추가 측점 저장분 기억: 저장 [127 · 163] → 서버가 [적용]으로 지움 → 다시 세운 페이지가 읽는 값. */ +async function plusAfterApply(reload) { + let server = [127, 163]; + const drafts = new Map(); + global.window = { setTimeout: () => 0, clearTimeout: () => undefined }; + global.fetch = async () => ({ + ok: true, + json: async () => ({ chainages: server, stations: server.map((c) => ({ chainage_m: c })) }), + }); + const plus = loadTs("B05_Profile/B05_Profile_Api_PlusStations.ts", { + "../config/config_frontend": { API_BASE_URL: "", API_TIMEOUT_MS: 1000 }, + "../A00_Common/design/design_store": { + draftProjectId: () => "p", + useDesignStore: () => ({ + get: (k) => drafts.get(k) ?? null, + set: (k, v) => drafts.set(k, v), + }), + }, + "./B05_Profile_UI_Profile_History": { onPageHistory: () => undefined }, + }); + await plus.loadSavedPlusStations("p"); + plus.followPlusDraft("p", { plusStations: [127, 163] }); // 노선 끌기 따라감 기억 + const before = plus.plusStationsOf("p"); + server = []; // 추천 [적용] — 서버가 지움 · 세션 초안 비움(clearDrafts) + drafts.clear(); + if (reload) await plus.reloadSavedPlusStations("p"); + await plus.loadSavedPlusStations("p"); // 다시 세운 페이지 + return { before, after: plus.plusStationsOf("p"), body: plus.plusStationsPart("p").body }; +} + async function main() { const input = JSON.parse(fs.readFileSync(process.argv[2], "utf8")); + const plusApply = { fixed: await plusAfterApply(true), stale: await plusAfterApply(false) }; const texts = {}; for (const [name, server] of Object.entries(input.servers)) texts[name] = await applyText(server); process.stdout.write( JSON.stringify({ texts, + plusApply, notice: reset.routeResetNotice(input.reset, 2), noticeNone: [ reset.routeResetNotice(undefined), diff --git a/resources/tester/test_283_route_reset_confirm.py b/resources/tester/test_283_route_reset_confirm.py index ddafd1a74..128b437ee 100644 --- a/resources/tester/test_283_route_reset_confirm.py +++ b/resources/tester/test_283_route_reset_confirm.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- -"""283 · 493-2 B05 [저장] = 보이는 화면 그대로 · 초기화 기준 = 노선 추천 [적용](요구 289 · 290). +"""283 · 493-2 · 493-5 B05 [저장] = 보이는 화면 그대로 · 초기화 기준 = 노선 추천 [적용](요구 289 · 290). - 손 고침 [저장] — 띠 · 확인 창 · 저장 뒤 초기화 알림 · 세션 초안 통째 비움 없음(492-2 걷음 · 소스 확인). - 추천 [적용] 확인 창 — 지워질 수 = 서버 저장분(구조물 · 관 · 추가 측점) = 적용 뒤 알림 수 (서버 `route_reset.dropped` = 저장 파일 길이) · 세션 초안은 안 셈 · 관 저장 파일 없음 = 0. +- [적용] 뒤 추가 측점 저장분 다시 받음 — 지운 측점이 목록 · [저장]에 남지 않음(493-5). """ from __future__ import annotations @@ -118,3 +119,23 @@ def test_적용뒤_알림_dropped(ts): "노선이 바뀌어 초기화했습니다 — 지움: 구조물 1 · 관 3 · 추가 측점 1 · 새 교차 관 2" ) assert ts["noticeNone"] == [None, None] + + +# ── 493-5 [적용] 뒤 화면 초안 = 새 초기값 ──────────────────────────────────── + + +def test_적용뒤_추가측점_저장분_다시받음(ts): + fixed, stale = ts["plusApply"]["fixed"], ts["plusApply"]["stale"] + assert fixed["before"] == [127, 163] + assert fixed["after"] == [] and fixed["body"] is None # [저장]이 지운 측점을 다시 안 보냄 + assert stale["after"] == [127, 163] # 대조 — 다시 안 받으면 옛 저장분이 남음(고치기 전) + + +def test_적용_배선_추가측점_다시받기(): + src = _read("B05_Profile", "B05_Profile_UI_RouteEdit_Apply.ts") + body = src[src.index("export async function saveRecommendedRoute(") :] + assert ( + body.index("clearDrafts(projectId)") + < body.index("await reloadSavedPlusStations(projectId)") + < body.index("await rebuildAfterRouteSave(projectId)") + )