Merge branch 'dev' into immediate-finds

This commit is contained in:
Nuckyz 2024-05-15 23:02:13 -03:00
commit 7f5aaada88
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 7 additions and 4 deletions

View file

@ -170,13 +170,14 @@ export const startPlugin = traceFunction("startPlugin", function startPlugin(p:
} }
try { try {
p.start(); p.start();
p.started = true;
} catch (e) { } catch (e) {
logger.error(`Failed to start ${name}\n`, e); logger.error(`Failed to start ${name}\n`, e);
return false; return false;
} }
} }
p.started = true;
if (commands?.length) { if (commands?.length) {
logger.debug("Registering commands of plugin", name); logger.debug("Registering commands of plugin", name);
for (const cmd of commands) { for (const cmd of commands) {
@ -206,6 +207,7 @@ export const startPlugin = traceFunction("startPlugin", function startPlugin(p:
export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plugin) { export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plugin) {
const { name, commands, flux, contextMenus } = p; const { name, commands, flux, contextMenus } = p;
if (p.stop) { if (p.stop) {
logger.info("Stopping plugin", name); logger.info("Stopping plugin", name);
if (!p.started) { if (!p.started) {
@ -214,13 +216,14 @@ export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plu
} }
try { try {
p.stop(); p.stop();
p.started = false;
} catch (e) { } catch (e) {
logger.error(`Failed to stop ${name}\n`, e); logger.error(`Failed to stop ${name}\n`, e);
return false; return false;
} }
} }
p.started = false;
if (commands?.length) { if (commands?.length) {
logger.debug("Unregistering commands of plugin", name); logger.debug("Unregistering commands of plugin", name);
for (const cmd of commands) { for (const cmd of commands) {

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { proxyLazy } from "@utils/lazy"; import { makeLazy, proxyLazy } from "@utils/lazy";
import { LazyComponent } from "@utils/lazyReact"; import { LazyComponent } from "@utils/lazyReact";
import { Logger } from "@utils/Logger"; import { Logger } from "@utils/Logger";
import { canonicalizeMatch } from "@utils/patches"; import { canonicalizeMatch } from "@utils/patches";
@ -714,7 +714,7 @@ export async function extractAndLoadChunks(code: string[], matcher: RegExp = Def
export function extractAndLoadChunksLazy(code: string[], matcher = DefaultExtractAndLoadChunksRegex) { export function extractAndLoadChunksLazy(code: string[], matcher = DefaultExtractAndLoadChunksRegex) {
if (IS_DEV) webpackSearchHistory.push(["extractAndLoadChunks", [code, matcher]]); if (IS_DEV) webpackSearchHistory.push(["extractAndLoadChunks", [code, matcher]]);
return () => extractAndLoadChunks(code, matcher); return makeLazy(() => extractAndLoadChunks(code, matcher));
} }
/** /**