From 6675a667987a681b1dbcaf7b4748df99e15cc4b6 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Sun, 6 Jul 2025 11:50:00 +0200 Subject: [PATCH] fix(webui): handle config having no worldState entry at all --- src/controllers/custom/configController.ts | 2 ++ static/webui/index.html | 2 +- static/webui/script.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/controllers/custom/configController.ts b/src/controllers/custom/configController.ts index 5b318a47..0cc28698 100644 --- a/src/controllers/custom/configController.ts +++ b/src/controllers/custom/configController.ts @@ -37,6 +37,8 @@ const configIdToIndexable = (id: string): [Record; const arr = id.split("."); while (arr.length > 1) { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + obj[arr[0]] ??= {} as never; obj = obj[arr[0]]; arr.splice(0, 1); } diff --git a/static/webui/index.html b/static/webui/index.html index aab8f87b..63d4d936 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -870,7 +870,7 @@
- diff --git a/static/webui/script.js b/static/webui/script.js index 05ccc157..9649019e 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -2010,7 +2010,7 @@ single.getRoute("/webui/cheats").on("beforeload", function () { if (elm.type == "checkbox") { elm.checked = value; } else if (elm.classList.contains("tags-input")) { - elm.value = value.join(", "); + elm.value = (value ?? []).join(", "); elm.oninput(); } else { elm.value = value ?? elm.getAttribute("data-default");