@samitouri / QOSami-HFS / commits / 5d31a271

fix: admin/plugins: installing a plugin could result in a (temporary) duplicate in the installed list

Massimo Melina committed May 18, 2024 at 18:24 UTC 5d31a2717d5ab592361fb0f6ff6c84008bcb8f40
1 file changed +2 -1
src/plugins.ts
+2 -1
@@ -316,7 +316,7 @@ export async function rescan() {
316 function watchPlugin(id: string, path: string) {
317 const module = resolve(path)
318 let starting: PendingPromise | undefined
319 - enablePlugins.sub(() => { // we take care of enabled-state after it was loaded
319 + const unsub = enablePlugins.sub(() => { // we take care of enabled-state after it was loaded
320 if (!getPluginInfo(id)) return // not loaded yet
321 const enabled = isPluginEnabled(id)
322 if (enabled !== isPluginRunning(id))
@@ -334,6 +334,7 @@ function watchPlugin(id: string, path: string) {
334 events.emit(notRunning ? 'pluginUpdated' : 'pluginInstalled', p)
335 })
336 return () => {
337 + unsub()
338 unwatch()
339 return onUninstalled()
340 }