From a2560ede1c15896664d9c9b6301817ae96249c86 Mon Sep 17 00:00:00 2001 From: V Date: Thu, 23 Nov 2023 02:20:02 +0100 Subject: [PATCH] fix showConnections & better webpack errors --- src/plugins/showConnections/index.tsx | 2 +- src/webpack/webpack.ts | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/showConnections/index.tsx b/src/plugins/showConnections/index.tsx index 67fcc968..d4d59465 100644 --- a/src/plugins/showConnections/index.tsx +++ b/src/plugins/showConnections/index.tsx @@ -31,7 +31,7 @@ import { User } from "discord-types/general"; import { VerifiedIcon } from "./VerifiedIcon"; -const Section = findComponentByCodeLazy(".lastSection]: "); +const Section = findComponentByCodeLazy(".lastSection", "children:"); const ThemeStore = findStoreLazy("ThemeStore"); const platforms: { get(type: string): ConnectionPlatform; } = findByPropsLazy("isSupported", "getByUrl"); const getTheme: (user: User, displayProfile: any) => any = findByCodeLazy(',"--profile-gradient-primary-color"'); diff --git a/src/webpack/webpack.ts b/src/webpack/webpack.ts index 9e3a0aab..d8743e30 100644 --- a/src/webpack/webpack.ts +++ b/src/webpack/webpack.ts @@ -18,7 +18,7 @@ import { proxyLazy } from "@utils/lazy"; import { Logger } from "@utils/Logger"; -import { LazyComponent, NoopComponent } from "@utils/react"; +import { LazyComponent } from "@utils/react"; import type { WebpackInstance } from "discord-types/other"; import { traceFunction } from "../debug/Tracer"; @@ -398,13 +398,18 @@ export function findStoreLazy(name: string) { */ export function findComponentByCode(...code: string[]) { const filter = filters.byCode(...code); - return find(m => { + const res = find(m => { if (filter(m)) return true; if (!m.$$typeof) return false; if (m.type) return filter(m.type); // memos if (m.render) return filter(m.render); // forwardRefs return false; - }) ?? NoopComponent; + }, { isIndirect: true }); + + if (!res) + handleModuleNotFound("findComponentByCode", ...code); + + return res; } /**