From ed3cc83fed0e2423fa2d5850e140b59d9320affd Mon Sep 17 00:00:00 2001 From: Marc Emmanuel Date: Tue, 3 Feb 2026 16:42:15 +0100 Subject: [PATCH] fix: clean up neighbors references on state removal --- public/modules/dynamic/editors/states-editor.js | 6 ++++++ public/modules/ui/editors.js | 2 +- public/versioning.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/public/modules/dynamic/editors/states-editor.js b/public/modules/dynamic/editors/states-editor.js index cbbfab20..e8351218 100644 --- a/public/modules/dynamic/editors/states-editor.js +++ b/public/modules/dynamic/editors/states-editor.js @@ -640,6 +640,12 @@ function stateRemove(stateId) { }); armies.select("g#army" + stateId).remove(); + // clean up neighbors references from other states + pack.states.forEach(state => { + if (!state.i || state.removed || !state.neighbors) return; + state.neighbors = state.neighbors.filter(n => n !== stateId); + }); + pack.states[stateId] = {i: stateId, removed: true}; debug.selectAll(".highlight").remove(); diff --git a/public/modules/ui/editors.js b/public/modules/ui/editors.js index 50eaf1c7..a87572c1 100644 --- a/public/modules/ui/editors.js +++ b/public/modules/ui/editors.js @@ -991,7 +991,7 @@ function refreshAllEditors() { // dynamically loaded editors async function editStates() { if (customization) return; - const Editor = await import("../dynamic/editors/states-editor.js?v=1.108.1"); + const Editor = await import("../dynamic/editors/states-editor.js?v=1.112.1"); Editor.open(); } diff --git a/public/versioning.js b/public/versioning.js index fc81870d..fd2a67a2 100644 --- a/public/versioning.js +++ b/public/versioning.js @@ -13,7 +13,7 @@ * Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2 */ -const VERSION = "1.112.0"; +const VERSION = "1.112.1"; if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function"); {