From aded5c9498a12ebcb89256a2f2f04ecac270619e Mon Sep 17 00:00:00 2001 From: Jos Warmer Date: Tue, 19 Nov 2024 19:14:22 +0100 Subject: [PATCH] Fix error that deleted units --- packages/webapp-lib/src/lib/language/EditorState.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/webapp-lib/src/lib/language/EditorState.ts b/packages/webapp-lib/src/lib/language/EditorState.ts index 5c800769a..eafddad84 100644 --- a/packages/webapp-lib/src/lib/language/EditorState.ts +++ b/packages/webapp-lib/src/lib/language/EditorState.ts @@ -180,9 +180,9 @@ export class EditorState { if (!!unit) { if (!!this.currentModel?.name && this.currentModel?.name?.length) { if (!!unit.name && unit.name.length > 0) { - if (get(currentUnitName).id === unit.freId()) { - // Saved unit already exists but its nbane has changed. - LOGGER.log("Saving unit that changed name, do a rename") + if (get(currentUnitName).id === unit.freId() && get(currentUnitName).name !== unit.name) { + // Saved unit already exists but its name has changed. + LOGGER.log(`Saving unit that changed name, do a rename from ${get(currentUnitName).name} to ${unit.name}`) await this.renameModelUnit(unit, get(currentUnitName).name, unit.name) } else { await this.modelStore.saveUnit(unit);