im the dumbest dumdum
This commit is contained in:
parent
251ee32e01
commit
14e68d9a24
1 changed files with 5 additions and 3 deletions
|
@ -9,14 +9,15 @@ import { classNameFactory } from "@api/Styles";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
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 { ComponentDispatch, FocusLock, i18n, Menu, useEffect, useRef } from "@webpack/common";
|
||||||
import type { HTMLAttributes, ReactElement } from "react";
|
import type { HTMLAttributes, ReactElement } from "react";
|
||||||
|
|
||||||
type SettingsEntry = { section: string, label: string; };
|
type SettingsEntry = { section: string, label: string; };
|
||||||
|
|
||||||
const cl = classNameFactory("");
|
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({
|
const settings = definePluginSettings({
|
||||||
disableFade: {
|
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
|
// 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
|
// not in children
|
||||||
Layer(props: LayerProps) {
|
Layer(props: LayerProps) {
|
||||||
if (!FocusLock || !ComponentDispatch) {
|
if (!FocusLock || !ComponentDispatch || !Classes) {
|
||||||
new Logger("BetterSettings").error("Failed to find some components");
|
new Logger("BetterSettings").error("Failed to find some components");
|
||||||
|
return props.children;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <Layer {...props} />;
|
return <Layer {...props} />;
|
||||||
|
|
Loading…
Reference in a new issue