From 43bc12713a5c282205954dc1da7a3bfbc8a07f47 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Mon, 6 Oct 2025 22:56:35 -0700 Subject: [PATCH] chore(webui): force account cheat element state after request is done (#2862) There's a very slim chance we get an inventory response between sending the setAccountCheat request and receiving the response, in which case the element state would be ingruent. Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2862 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com> --- static/webui/script.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/static/webui/script.js b/static/webui/script.js index 734e6a1f5..a2615eefa 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -3195,13 +3195,16 @@ function doIntrinsicsUnlockAll() { document.querySelectorAll("#account-cheats input[type=checkbox]").forEach(elm => { elm.onchange = function () { revalidateAuthz().then(() => { + const value = elm.checked; $.post({ url: "/custom/setAccountCheat?" + window.authz, contentType: "application/json", data: JSON.stringify({ key: elm.id, - value: elm.checked + value: value }) + }).done(() => { + elm.checked = value; }); }); }; @@ -3237,6 +3240,8 @@ document.querySelectorAll("#account-cheats .input-group").forEach(grp => { key: input.id, value: parseInt(value) }) + }).done(() => { + btn.value = value; }); }); };