diff --git a/src/components/PluginSettings/components/SettingArrayComponent.tsx b/src/components/PluginSettings/components/SettingArrayComponent.tsx index ff2c1f6c6..002ee1b94 100644 --- a/src/components/PluginSettings/components/SettingArrayComponent.tsx +++ b/src/components/PluginSettings/components/SettingArrayComponent.tsx @@ -89,8 +89,9 @@ export function SettingArrayComponent({ pluginSettings[id] = []; return; } - setItems(items.filter((_, i) => i !== index)); - pluginSettings[id] = items; + const newItems = items.filter((_, i) => i !== index); + setItems(newItems); + pluginSettings[id] = newItems; }; function renderGuildView() { @@ -253,9 +254,11 @@ export function SettingArrayComponent({ return; } - setItems([...items, inputElement.value]); + const newItems = [...items, inputElement.value]; - pluginSettings[id] = items; + setItems(newItems); + + pluginSettings[id] = newItems; inputElement.value = ""; }