From 80d7d908d752fbf5b3580686342ac87e35fe230e Mon Sep 17 00:00:00 2001 From: ck <21735205+cyperdark@users.noreply.github.com> Date: Tue, 29 Oct 2024 21:01:33 +0300 Subject: [PATCH] fix: Fix out of order replacement & `undefined` values --- packages/server/assets/homepage.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/server/assets/homepage.js b/packages/server/assets/homepage.js index 005c1166..825ef050 100644 --- a/packages/server/assets/homepage.js +++ b/packages/server/assets/homepage.js @@ -632,7 +632,6 @@ const showSettings = { const setting = props.settings[i]; let value = props.values[setting.uniqueID] ?? setting.value; - if (setting.type == "commands") { setting.options.forEach(r => { if (r.values) r.values = r.values.filter(r => r !== '' && r != null); @@ -641,14 +640,12 @@ const showSettings = { setting.value.forEach((command, cmd_ind) => { setting.options.forEach(option => { - const original = setting.value[cmd_ind][option.name]; - const modified = value[cmd_ind][option.name]; - - if (modified == null) return; + const original = command[option.name]; + const modified = value.find(r => r[setting.uniqueCheck] == command[setting.uniqueCheck])?.[option.name]; if (original == modified) return; - setting.value[cmd_ind][option.name] = modified; - }) + setting.value[cmd_ind][option.name] = modified ?? original; + }); });