From 38b035966bdca536ccfbc3bf4c03524ccf8ac637 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Fri, 18 Jul 2025 02:02:34 +0700 Subject: [PATCH] chore: cleanup --- src/plugins/start/developer-settings/index.ts | 5 +- src/plugins/start/error-boundary/index.tsx | 49 ++++++++++--------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/plugins/start/developer-settings/index.ts b/src/plugins/start/developer-settings/index.ts index 087080b..5a857b5 100644 --- a/src/plugins/start/developer-settings/index.ts +++ b/src/plugins/start/developer-settings/index.ts @@ -43,14 +43,15 @@ registerPlugin<{ storage: Storage }>( if (api_.plugin.flags & PluginFlags.EnabledLate) refreshSettingsOverviewScreen() - api_.cleanup(refreshSettingsOverviewScreen) - Promise.all([import('./react-devtools'), api.storage.get()]).then( ([rdt, settings]) => { if (settings.devtools.autoConnect) rdt.connect() }, ) }, + stop() { + refreshSettingsOverviewScreen() + }, }, PluginFlags.Enabled, InternalPluginFlags.Internal, diff --git a/src/plugins/start/error-boundary/index.tsx b/src/plugins/start/error-boundary/index.tsx index 6ca0d8a..0498653 100644 --- a/src/plugins/start/error-boundary/index.tsx +++ b/src/plugins/start/error-boundary/index.tsx @@ -16,31 +16,34 @@ registerPlugin( }, { start({ cleanup }) { - const unsubEB = waitForModules(byName('ErrorBoundary'), exports => { - unsubEB() + const unsubEB = waitForModules( + byName('ErrorBoundary'), + exports => { + unsubEB() - instead( - (exports as typeof DiscordErrorBoundary).prototype, - 'render', - function (this: DiscordErrorBoundary) { - if (this.state.error) - return ( - { - this.setState({ - error: null, - info: null, - }) - }} - /> - ) + instead( + exports.prototype, + 'render', + function (this: DiscordErrorBoundary) { + if (this.state.error) + return ( + { + this.setState({ + error: null, + info: null, + }) + }} + /> + ) - return this.props.children - }, - ) - }) + return this.props.children + }, + ) + }, + ) cleanup(unsubEB) },