From 08036f7af28dba4978abed93f9a7b6af5cf979cb Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Wed, 6 Dec 2023 01:37:42 -0300
Subject: [PATCH] convert non lazy finds to test with reporter

---
 src/plugins/muteNewGuild/index.tsx       | 6 ++++--
 src/plugins/webContextMenus.web/index.ts | 6 +++---
 src/utils/modal.tsx                      | 4 ++--
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/plugins/muteNewGuild/index.tsx b/src/plugins/muteNewGuild/index.tsx
index 7586830b..08c558a9 100644
--- a/src/plugins/muteNewGuild/index.tsx
+++ b/src/plugins/muteNewGuild/index.tsx
@@ -19,7 +19,9 @@
 import { definePluginSettings } from "@api/Settings";
 import { Devs } from "@utils/constants";
 import definePlugin, { OptionType } from "@utils/types";
-import { findByProps } from "@webpack";
+import { findByPropsLazy } from "@webpack";
+
+const { updateGuildNotificationSettings } = findByPropsLazy("updateGuildNotificationSettings");
 
 const settings = definePluginSettings({
     guild: {
@@ -63,7 +65,7 @@ export default definePlugin({
 
     handleMute(guildId: string | null) {
         if (guildId === "@me" || guildId === "null" || guildId == null) return;
-        findByProps("updateGuildNotificationSettings").updateGuildNotificationSettings(guildId,
+        updateGuildNotificationSettings(guildId,
             {
                 muted: settings.store.guild,
                 suppress_everyone: settings.store.everyone,
diff --git a/src/plugins/webContextMenus.web/index.ts b/src/plugins/webContextMenus.web/index.ts
index cf50bb86..eb076dfd 100644
--- a/src/plugins/webContextMenus.web/index.ts
+++ b/src/plugins/webContextMenus.web/index.ts
@@ -20,9 +20,11 @@ import { definePluginSettings } from "@api/Settings";
 import { Devs } from "@utils/constants";
 import definePlugin, { OptionType } from "@utils/types";
 import { saveFile } from "@utils/web";
-import { findByProps } from "@webpack";
+import { findByPropsLazy } from "@webpack";
 import { Clipboard, ComponentDispatch } from "@webpack/common";
 
+const ctxMenuCallbacks = findByPropsLazy("contextMenuCallbackNative");
+
 async function fetchImage(url: string) {
     const res = await fetch(url);
     if (res.status !== 200) return;
@@ -55,7 +57,6 @@ export default definePlugin({
 
     start() {
         if (settings.store.addBack) {
-            const ctxMenuCallbacks = findByProps("contextMenuCallbackNative");
             window.removeEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackWeb);
             window.addEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackNative);
             this.changedListeners = true;
@@ -64,7 +65,6 @@ export default definePlugin({
 
     stop() {
         if (this.changedListeners) {
-            const ctxMenuCallbacks = findByProps("contextMenuCallbackNative");
             window.removeEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackNative);
             window.addEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackWeb);
         }
diff --git a/src/utils/modal.tsx b/src/utils/modal.tsx
index 6758a1a1..b4d0f59f 100644
--- a/src/utils/modal.tsx
+++ b/src/utils/modal.tsx
@@ -16,7 +16,7 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
 
-import { findByProps, findByPropsLazy } from "@webpack";
+import { findByPropsLazy, findExportedComponentLazy } from "@webpack";
 import type { ComponentType, PropsWithChildren, ReactNode, Ref } from "react";
 
 import { LazyComponent } from "./react";
@@ -118,7 +118,7 @@ export type ImageModal = ComponentType<{
     shouldHideMediaOptions?: boolean;
 }>;
 
-export const ImageModal = LazyComponent(() => findByProps("ImageModal").ImageModal as ImageModal);
+export const ImageModal = findExportedComponentLazy("ImageModal") as ImageModal;
 
 export const ModalRoot = LazyComponent(() => Modals.ModalRoot);
 export const ModalHeader = LazyComponent(() => Modals.ModalHeader);