From 1bab53298104dcb0094dd65a0205e2182377707d Mon Sep 17 00:00:00 2001 From: kmmiio99o Date: Sat, 1 Aug 2026 19:12:02 +0200 Subject: [PATCH] fix: patches not applying --- plugins/ServerDrawer/src/patches/contentPatch.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/ServerDrawer/src/patches/contentPatch.tsx b/plugins/ServerDrawer/src/patches/contentPatch.tsx index 669645c..735bcad 100644 --- a/plugins/ServerDrawer/src/patches/contentPatch.tsx +++ b/plugins/ServerDrawer/src/patches/contentPatch.tsx @@ -5,22 +5,28 @@ import { registerIntercept } from "./createElementIntercept"; const TAG = "[ServerDrawer]"; -const QuestDockGestureContext = find((m) => m?.QuestDockGestureContext)?.QuestDockGestureContext; +let cachedGestureContext: any = null; +function getGestureContext(): any { + if (!cachedGestureContext) { + cachedGestureContext = find((m) => m?.QuestDockGestureContext)?.QuestDockGestureContext ?? null; + } + return cachedGestureContext; +} export function patchExpanded( cleanups: (() => void)[] ): boolean { const mod = find((m) => m?.type?.displayName === "QuestDockContentExpanded" || m?.type?.name === "QuestDockContentExpanded"); if (!mod?.type) { - console.log(TAG, "WARN: QuestDockContentExpanded not found"); + console.log(TAG, "WARN: QuestDockContentExpanded not found (will retry)"); return false; } const orig = mod.type; - registerIntercept(orig, ServerDrawerSheet, { gestureContext: QuestDockGestureContext }); + registerIntercept(orig, ServerDrawerSheet, { gestureContext: getGestureContext() }); mod.type = function ServerDrawerPatch() { - return ; + return ; }; cleanups.push(() => { mod.type = orig; }); console.log(TAG, "PATCH: QuestDockContentExpanded replaced");