fix(webui): handle config having no worldState entry at all (#2427)
Reviewed-on: #2427 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
80b5e2df7f
commit
1545cdb8ce
@ -37,6 +37,8 @@ const configIdToIndexable = (id: string): [Record<string, boolean | string | num
|
||||
let obj = config as unknown as Record<string, never>;
|
||||
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);
|
||||
}
|
||||
|
@ -870,7 +870,7 @@
|
||||
</div>
|
||||
<div class="form-group mt-2">
|
||||
<label class="form-label" for="worldState.galleonOfGhouls" data-loc="worldState_galleonOfGhouls"></label>
|
||||
<select class="form-control" id="worldState.galleonOfGhouls" data-default="">
|
||||
<select class="form-control" id="worldState.galleonOfGhouls" data-default="0">
|
||||
<option value="0" data-loc="disabled"></option>
|
||||
<option value="1" data-loc="worldState_we1"></option>
|
||||
<option value="2" data-loc="worldState_we2"></option>
|
||||
|
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user