im the dumbest dumdum

This commit is contained in:
Vendicated 2024-05-09 03:12:11 +02:00
parent 251ee32e01
commit 14e68d9a24
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18

View file

@ -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<string, string>;
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 <Layer {...props} />;