diff --git a/src/plugins/betterSettings/index.tsx b/src/plugins/betterSettings/index.tsx index c9bf070fa..5064bd538 100644 --- a/src/plugins/betterSettings/index.tsx +++ b/src/plugins/betterSettings/index.tsx @@ -9,14 +9,15 @@ import { classNameFactory } from "@api/Styles"; import { Devs } from "@utils/constants"; import { Logger } from "@utils/Logger"; import definePlugin, { OptionType } from "@utils/types"; -import { findByPropsLazy } from "@webpack"; +import { waitFor } from "@webpack"; import { ComponentDispatch, FocusLock, i18n, Menu, useEffect, useRef } from "@webpack/common"; import type { HTMLAttributes, ReactElement } from "react"; type SettingsEntry = { section: string, label: string; }; const cl = classNameFactory(""); -const Classes = findByPropsLazy("animating", "baseLayer", "bg", "layer", "layers"); +let Classes: Record; +waitFor(["animating", "baseLayer", "bg", "layer", "layers"], m => Classes = m); const settings = definePluginSettings({ disableFade: { @@ -131,8 +132,9 @@ export default definePlugin({ // 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 Layer(props: LayerProps) { - if (!FocusLock || !ComponentDispatch) { + if (!FocusLock || !ComponentDispatch || !Classes) { new Logger("BetterSettings").error("Failed to find some components"); + return props.children; } return ;