diff options
author | Nuckyz <61953774+Nuckyz@users.noreply.github.com> | 2023-09-02 03:03:31 -0300 |
---|---|---|
committer | Nuckyz <61953774+Nuckyz@users.noreply.github.com> | 2023-09-02 03:03:31 -0300 |
commit | 29fbe3701a906685ab1e7da07c9a4e155efa98d6 (patch) | |
tree | bb80885597c27525b4b9768ea177a99202789021 /src/plugins | |
parent | 0b7c0e958772d4204ad286f0c09fff0add1f1f2d (diff) | |
download | Vencord-29fbe3701a906685ab1e7da07c9a4e155efa98d6.tar.gz Vencord-29fbe3701a906685ab1e7da07c9a4e155efa98d6.tar.bz2 Vencord-29fbe3701a906685ab1e7da07c9a4e155efa98d6.zip |
Fix CrashHandler patch
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/crashHandler.ts | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/plugins/crashHandler.ts b/src/plugins/crashHandler.ts index f15fb8e..a1ba01c 100644 --- a/src/plugins/crashHandler.ts +++ b/src/plugins/crashHandler.ts @@ -23,10 +23,12 @@ import { Logger } from "@utils/Logger"; import { closeAllModals } from "@utils/modal"; import definePlugin, { OptionType } from "@utils/types"; import { maybePromptToUpdate } from "@utils/updater"; +import { findByPropsLazy } from "@webpack"; import { FluxDispatcher, NavigationRouter } from "@webpack/common"; import type { ReactElement } from "react"; const CrashHandlerLogger = new Logger("CrashHandler"); +const ModalStack = findByPropsLazy("pushLazy", "popAll"); const settings = definePluginSettings({ attemptToPreventCrashes: { @@ -51,8 +53,6 @@ export default definePlugin({ authors: [Devs.Nuckyz], enabledByDefault: true, - popAllModals: undefined as (() => void) | undefined, - settings, patches: [ @@ -62,13 +62,6 @@ export default definePlugin({ match: /(?=this\.setState\()/, replace: "$self.handleCrash(this)||" } - }, - { - find: 'dispatch({type:"MODAL_POP_ALL"})', - replacement: { - match: /"MODAL_POP_ALL".+?};(?<=(\i)=function.+?)/, - replace: (m, popAll) => `${m}$self.popAllModals=${popAll};` - } } ], @@ -128,7 +121,7 @@ export default definePlugin({ CrashHandlerLogger.debug("Failed to close open context menu.", err); } try { - this.popAllModals?.(); + ModalStack?.popAll(); } catch (err) { CrashHandlerLogger.debug("Failed to close old modals.", err); } |