From b0a7b5ce908ad894781dc89029fcd728775d000a Mon Sep 17 00:00:00 2001 From: wenyu Date: Wed, 18 Mar 2026 18:30:54 +0800 Subject: [PATCH] =?UTF-8?q?refactor(migration):=20=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E7=88=B6=E8=A1=8C=E6=98=9F=20ID=20=E7=9A=84=E6=98=A0=E5=B0=84?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除冗余的 idMap.has 检查,直接使用 idMap.get 获取新 ID --- src/utils/migration.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/utils/migration.ts b/src/utils/migration.ts index e6f586c..cc871b9 100644 --- a/src/utils/migration.ts +++ b/src/utils/migration.ts @@ -141,12 +141,10 @@ export const migrateGameData = (): void => { const posKey = `${planet.position.galaxy}:${planet.position.system}:${planet.position.position}` const mapKey = `${planet.parentPlanetId}_${posKey}` - if (idMap.has(mapKey)) { - const newParentId = idMap.get(mapKey) - if (newParentId) { - planet.parentPlanetId = newParentId - needsSave = true - } + const newParentId = idMap.get(mapKey) + if (newParentId) { + planet.parentPlanetId = newParentId + needsSave = true } } })