From 4cc6789b5b346ad91fefba7a2dc05245e06f6f84 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Wed, 8 May 2024 00:25:34 -0300 Subject: [PATCH] misc fixes --- src/api/Styles.ts | 4 ++-- src/plugins/fakeNitro/index.tsx | 1 - src/utils/lazy.ts | 2 +- src/webpack/webpack.tsx | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/api/Styles.ts b/src/api/Styles.ts index 6b0ac2cdf..023299c17 100644 --- a/src/api/Styles.ts +++ b/src/api/Styles.ts @@ -89,8 +89,8 @@ export const isStyleEnabled = (name: string) => requireStyle(name).dom?.isConnec * // -- plugin.ts -- * import pluginStyle from "./plugin.css?managed"; * import { setStyleVars } from "@api/Styles"; - * import { findByPropsLazy } from "@webpack"; - * const classNames = findByPropsLazy("thin", "scrollerBase"); // { thin: "thin-31rlnD scrollerBase-_bVAAt", ... } + * import { findByProps } from "@webpack"; + * const classNames = findByProps("thin", "scrollerBase"); // { thin: "thin-31rlnD scrollerBase-_bVAAt", ... } * * // Inside some plugin method like "start()" * setStyleClassNames(pluginStyle, classNames); diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index cf7f7adaf..43134d775 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -52,7 +52,6 @@ const PreloadedUserSettingsActionCreators = webpackDependantLazy(() => UserSetti const AppearanceSettingsActionCreators = webpackDependantLazy(() => searchProtoClassField("appearance", PreloadedUserSettingsActionCreators.ProtoClass)); const ClientThemeSettingsActionsCreators = webpackDependantLazy(() => searchProtoClassField("clientThemeSettings", AppearanceSettingsActionCreators)); - const enum EmojiIntentions { REACTION = 0, STATUS = 1, diff --git a/src/utils/lazy.ts b/src/utils/lazy.ts index 664d4e114..554649f18 100644 --- a/src/utils/lazy.ts +++ b/src/utils/lazy.ts @@ -91,7 +91,7 @@ export function proxyLazy(factory: () => T, attempts = 5, isChild = fal // If we're still in the same tick, it means the lazy was immediately used. // thus, we lazy proxy the get access to make things like destructuring work as expected // meow here will also be a lazy - // `const { meow } = findByPropsLazy("meow");` + // `const { meow } = proxyLazy(() => ({ meow: [] }));` if (!isChild && isSameTick) { return proxyLazy( () => Reflect.get(target[proxyLazyGet](), p, receiver), diff --git a/src/webpack/webpack.tsx b/src/webpack/webpack.tsx index 6c0222a0e..666f82a09 100644 --- a/src/webpack/webpack.tsx +++ b/src/webpack/webpack.tsx @@ -341,7 +341,7 @@ export function findStore(name: string) { * @param filter A function that takes a module and returns a boolean * @returns The found module or null */ -export const cacheFind = traceFunction("find", function find(filter: FilterFn) { +export const cacheFind = traceFunction("cacheFind", function cacheFind(filter: FilterFn) { if (typeof filter !== "function") throw new Error("Invalid filter. Expected a function got " + typeof filter); @@ -389,7 +389,7 @@ export function cacheFindAll(filter: FilterFn) { * need it afterwards, pass a copy. * @returns Array of results in the same order as the passed filters */ -export const cacheFindBulk = traceFunction("findBulk", function findBulk(...filterFns: FilterFn[]) { +export const cacheFindBulk = traceFunction("cacheFindBulk", function cacheFindBulk(...filterFns: FilterFn[]) { if (!Array.isArray(filterFns)) throw new Error("Invalid filters. Expected function[] got " + typeof filterFns);