aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/PluginSettings/index.tsx15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx
index 58058b1..4b6abdd 100644
--- a/src/components/PluginSettings/index.tsx
+++ b/src/components/PluginSettings/index.tsx
@@ -92,12 +92,9 @@ interface PluginCardProps extends React.HTMLProps<HTMLDivElement> {
}
function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLeave, isNew }: PluginCardProps) {
- const settings = useSettings();
- const pluginSettings = settings.plugins[plugin.name];
+ const settings = useSettings([`plugins.${plugin.name}`]).plugins[plugin.name];
- function isEnabled() {
- return pluginSettings?.enabled || plugin.started;
- }
+ const isEnabled = () => settings.enabled ?? false;
function openModal() {
openModalLazy(async () => {
@@ -119,7 +116,7 @@ function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLe
return;
} else if (restartNeeded) {
// If any dependencies have patches, don't start the plugin yet.
- pluginSettings.enabled = true;
+ settings.enabled = true;
onRestartNeeded(plugin.name);
return;
}
@@ -127,14 +124,14 @@ function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLe
// if the plugin has patches, dont use stopPlugin/startPlugin. Wait for restart to apply changes.
if (plugin.patches) {
- pluginSettings.enabled = !wasEnabled;
+ settings.enabled = !wasEnabled;
onRestartNeeded(plugin.name);
return;
}
// If the plugin is enabled, but hasn't been started, then we can just toggle it off.
if (wasEnabled && !plugin.started) {
- pluginSettings.enabled = !wasEnabled;
+ settings.enabled = !wasEnabled;
return;
}
@@ -147,7 +144,7 @@ function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLe
return;
}
- pluginSettings.enabled = !wasEnabled;
+ settings.enabled = !wasEnabled;
}
return (