fix(config-editor): preserve source YAML edits and empty keys

This commit is contained in:
Supra4E8C
2026-02-28 13:33:20 +08:00
Unverified
parent 72c0ef07ed
commit 5ccf1da86b
2 changed files with 15 additions and 7 deletions
+5 -1
View File
@@ -78,7 +78,11 @@ function setStringInDoc(doc: YamlDocument, path: YamlPath, value: unknown): void
doc.setIn(path, safe);
return;
}
if (docHas(doc, path)) doc.deleteIn(path);
// Preserve existing empty-string keys to avoid dropping template blocks/comments.
// Only keep the key when it already exists in the YAML.
if (docHas(doc, path)) {
doc.setIn(path, '');
}
}
function setIntFromStringInDoc(doc: YamlDocument, path: YamlPath, value: unknown): void {