From 0bebc85b0dc08c9345210499dc9d24dd14c64ac0 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sat, 20 Apr 2024 11:50:28 +0200 Subject: [PATCH] fix FriendsSince on canary --- src/plugins/friendsSince/index.tsx | 16 +++++++++++++--- src/webpack/webpack.ts | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/plugins/friendsSince/index.tsx b/src/plugins/friendsSince/index.tsx index dd37137..69d8e73 100644 --- a/src/plugins/friendsSince/index.tsx +++ b/src/plugins/friendsSince/index.tsx @@ -7,12 +7,22 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import { getCurrentChannel } from "@utils/discord"; +import { makeLazy } from "@utils/lazy"; import definePlugin from "@utils/types"; -import { findByPropsLazy } from "@webpack"; +import { filters, find, findByPropsLazy, handleModuleNotFound } from "@webpack"; import { React, RelationshipStore } from "@webpack/common"; const { Heading, Text } = findByPropsLazy("Heading", "Text"); -const container = findByPropsLazy("memberSinceContainer"); +// Workaround for module differing on stable & canary +// FIXME: remove once merged into stable +const getMemberSinceContainer = makeLazy(() => { + for (const name of ["memberSinceWrapper", "memberSinceContainer"]) { + const mod = find(filters.byProps(name), { isIndirect: true }); + if (mod) return mod[name]; + } + handleModuleNotFound("findByProps", "memberSinceWrapper/memberSinceContainer"); + return ""; +}); const { getCreatedAtDate } = findByPropsLazy("getCreatedAtDate"); const clydeMoreInfo = findByPropsLazy("clydeMoreInfo"); const locale = findByPropsLazy("getLocale"); @@ -49,7 +59,7 @@ export default definePlugin({ Friends Since -
+
{!!getCurrentChannel()?.guild_id && (