Skip to content

Commit

Permalink
fix: Fix out of order replacement & undefined values
Browse files Browse the repository at this point in the history
  • Loading branch information
cyperdark committed Oct 29, 2024
1 parent 31cff8d commit 80d7d90
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/server/assets/homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
});
});


Expand Down

0 comments on commit 80d7d90

Please sign in to comment.