mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 23:38:32 +00:00
dispatch onchange when checkbox is clicked
This commit is contained in:
parent
56ed1e75cd
commit
8d9e9c49fa
1 changed files with 8 additions and 6 deletions
|
@ -41,12 +41,14 @@ function renderRegisteredPlugins(name: string, value: any) {
|
||||||
...prevState,
|
...prevState,
|
||||||
[key]: !prevState[key]
|
[key]: !prevState[key]
|
||||||
}));
|
}));
|
||||||
// @ts-ignore settings must be defined otherwise we wouldn't be here
|
|
||||||
const s = Vencord.Plugins.plugins[plugin].settings.store[setting];
|
// settings must be defined otherwise the checkbox wouldn't exist in the first place
|
||||||
// @ts-ignore
|
const s = Vencord.Plugins.plugins[plugin].settings!;
|
||||||
Vencord.Plugins.plugins[plugin].settings.store[setting] = s.includes(value.id)
|
s.store[setting] = s.store[setting].includes(value.id)
|
||||||
? s.filter(id => id !== value.id)
|
? s.store[setting].filter((id: string) => id !== value.id)
|
||||||
: [...s, value.id];
|
: [...s.store[setting], value.id];
|
||||||
|
|
||||||
|
s.def[setting].onChange?.(s.store[setting]);
|
||||||
|
|
||||||
};
|
};
|
||||||
return Object.keys(plugins).map(plugin => (
|
return Object.keys(plugins).map(plugin => (
|
||||||
|
|
Loading…
Add table
Reference in a new issue