From 599c33769ca97ecb18a78601fee98bb1287f1e5a Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Fri, 4 Apr 2025 00:12:17 -0400 Subject: [PATCH 1/2] Fix crashing when opening settings (#3350) Co-authored-by: Vendicated --- src/plugins/betterSettings/index.tsx | 9 +++++---- src/plugins/decor/ui/components/DecorSection.tsx | 4 ++-- src/webpack/common/components.ts | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/plugins/betterSettings/index.tsx b/src/plugins/betterSettings/index.tsx index 461dfaac..84e338ef 100644 --- a/src/plugins/betterSettings/index.tsx +++ b/src/plugins/betterSettings/index.tsx @@ -139,11 +139,12 @@ export default definePlugin({ // This is the very outer layer of the entire ui, so we can't wrap this in an ErrorBoundary // without possibly also catching unrelated errors of children. // - // Thus, we sanity check webpack modules & do this really hacky try catch to hopefully prevent hard crashes if something goes wrong. - // try catch will only catch errors in the Layer function (hence why it's called as a plain function rather than a component), but - // not in children + // Thus, we sanity check webpack modules Layer(props: LayerProps) { - if (!FocusLock || !ComponentDispatch || !Classes) { + try { + // @ts-ignore + [FocusLock.$$vencordInternal(), ComponentDispatch, Classes].forEach(e => e.test); + } catch { new Logger("BetterSettings").error("Failed to find some components"); return props.children; } diff --git a/src/plugins/decor/ui/components/DecorSection.tsx b/src/plugins/decor/ui/components/DecorSection.tsx index ff044f8c..4648ef8d 100644 --- a/src/plugins/decor/ui/components/DecorSection.tsx +++ b/src/plugins/decor/ui/components/DecorSection.tsx @@ -5,7 +5,7 @@ */ import { Flex } from "@components/Flex"; -import { findByCodeLazy } from "@webpack"; +import { findComponentByCodeLazy } from "@webpack"; import { Button, useEffect } from "@webpack/common"; import { useAuthorizationStore } from "../../lib/stores/AuthorizationStore"; @@ -13,7 +13,7 @@ import { useCurrentUserDecorationsStore } from "../../lib/stores/CurrentUserDeco import { cl } from "../"; import { openChangeDecorationModal } from "../modals/ChangeDecorationModal"; -const CustomizationSection = findByCodeLazy(".customizationSectionBackground"); +const CustomizationSection = findComponentByCodeLazy(".customizationSectionBackground"); export interface DecorSectionProps { hideTitle?: boolean; diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index d5249f2f..a772c98d 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -25,7 +25,7 @@ import * as t from "./types/components"; const FormTitle = waitForComponent("FormTitle", filters.componentByCode('["defaultMargin".concat', '="h5"')); const FormText = waitForComponent("FormText", filters.componentByCode(".SELECTABLE),", ".DISABLED:")); -const FormSection = waitForComponent("FormSection", filters.componentByCode(".titleId)&&")); +const FormSection = waitForComponent("FormSection", filters.componentByCode(".titleId)")); const FormDivider = waitForComponent("FormDivider", filters.componentByCode(".divider,", ",style:", '"div"', /\.divider,\i\),style:/)); export const Forms = { @@ -74,7 +74,7 @@ export const ScrollerNone = LazyComponent(() => createScroller(scrollerClasses.n export const ScrollerThin = LazyComponent(() => createScroller(scrollerClasses.thin, scrollerClasses.fade, scrollerClasses.customTheme)); export const ScrollerAuto = LazyComponent(() => createScroller(scrollerClasses.auto, scrollerClasses.fade, scrollerClasses.customTheme)); -const { FocusLock_ } = mapMangledModuleLazy("attachTo:null!==", { +const { FocusLock_ } = mapMangledModuleLazy('document.getElementById("app-mount"))', { FocusLock_: filters.componentByCode(".containerRef") }) as { FocusLock_: t.FocusLock; From 22b50f03ca3fb9b1044bc6b8593e9e4c96028f31 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Fri, 4 Apr 2025 06:16:11 +0200 Subject: [PATCH 2/2] bump to 1.11.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 438efac4..bc4d7586 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vencord", "private": "true", - "version": "1.11.7", + "version": "1.11.8", "description": "The cutest Discord client mod", "homepage": "https://github.com/Vendicated/Vencord#readme", "bugs": {