fix: fix restartNeeded

This commit is contained in:
JellyBrick
2023-11-28 11:29:43 +09:00
parent 8714f33fa2
commit 8f7933c111
3 changed files with 6 additions and 6 deletions

View File

@ -157,7 +157,7 @@ const initHook = (win: BrowserWindow) => {
forceUnloadMainPlugin(id, win); forceUnloadMainPlugin(id, win);
} }
if (mainPlugins[id]?.restartNeeded) { if (allPlugins[id]?.restartNeeded) {
showNeedToRestartDialog(id); showNeedToRestartDialog(id);
} }
} }
@ -176,14 +176,14 @@ const initHook = (win: BrowserWindow) => {
}; };
const showNeedToRestartDialog = (id: string) => { const showNeedToRestartDialog = (id: string) => {
const plugin = mainPlugins[id]; const plugin = allPlugins[id];
const dialogOptions: Electron.MessageBoxOptions = { const dialogOptions: Electron.MessageBoxOptions = {
type: 'info', type: 'info',
buttons: ['Restart Now', 'Later'], buttons: ['Restart Now', 'Later'],
title: 'Restart Required', title: 'Restart Required',
message: `"${plugin.name ?? id}" needs to restart`, message: `"${plugin?.name ?? id}" needs to restart`,
detail: `"${plugin.name ?? id}" plugin requires a restart to take effect`, detail: `"${plugin?.name ?? id}" plugin requires a restart to take effect`,
defaultId: 0, defaultId: 0,
cancelId: 1, cancelId: 1,
}; };

View File

@ -29,7 +29,7 @@ export const forceUnloadPreloadPlugin = (id: string) => {
hasStopped || hasStopped ||
( (
hasStopped === null && hasStopped === null &&
typeof loadedPluginMap[id].preload !== 'function' && loadedPluginMap[id].preload loadedPluginMap[id].preload
) )
) { ) {
console.log(LoggerPrefix, `"${id}" plugin is unloaded`); console.log(LoggerPrefix, `"${id}" plugin is unloaded`);

View File

@ -48,7 +48,7 @@ export const forceUnloadRendererPlugin = (id: string) => {
hasStopped || hasStopped ||
( (
hasStopped === null && hasStopped === null &&
typeof plugin?.renderer !== 'function' && plugin?.renderer plugin?.renderer
) )
) { ) {
console.log(LoggerPrefix, `"${id}" plugin is unloaded`); console.log(LoggerPrefix, `"${id}" plugin is unloaded`);