Fix disabling plugins whose stop() errors
This commit is contained in:
parent
ab3e993274
commit
42d8211871
|
@ -138,11 +138,13 @@ function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLe
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = wasEnabled ? stopPlugin(plugin) : startPlugin(plugin);
|
const result = wasEnabled ? stopPlugin(plugin) : startPlugin(plugin);
|
||||||
const action = wasEnabled ? "stop" : "start";
|
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
logger.error(`Failed to ${action} plugin ${plugin.name}`);
|
settings.enabled = false;
|
||||||
showErrorToast(`Failed to ${action} plugin: ${plugin.name}`);
|
|
||||||
|
const msg = `Error while ${wasEnabled ? "stopping" : "starting"} plugin ${plugin.name}`;
|
||||||
|
logger.error(msg);
|
||||||
|
showErrorToast(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,6 @@ export default definePlugin({
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
FluxDispatcher.dispatch({ type: "LOCAL_ACTIVITY_UPDATE", activity: null }); // clear status
|
FluxDispatcher.dispatch({ type: "LOCAL_ACTIVITY_UPDATE", activity: null }); // clear status
|
||||||
ws.close(); // close WebSocket
|
ws?.close(); // close WebSocket
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue