Fix initializing custom themes with ThemeStore too early
This commit is contained in:
parent
707d688887
commit
c1f19d5288
11 changed files with 42 additions and 32 deletions
|
|
@ -17,9 +17,7 @@
|
|||
*/
|
||||
|
||||
import { LazyComponent, LazyComponentWrapper } from "@utils/react";
|
||||
|
||||
// eslint-disable-next-line path-alias/no-relative
|
||||
import { FilterFn, filters, lazyWebpackSearchHistory, waitFor } from "../webpack";
|
||||
import { FilterFn, filters, lazyWebpackSearchHistory, waitFor } from "@webpack";
|
||||
|
||||
export function waitForComponent<T extends React.ComponentType<any> = React.ComponentType<any> & Record<string, any>>(name: string, filter: FilterFn | string | string[]) {
|
||||
if (IS_REPORTER) lazyWebpackSearchHistory.push(["waitForComponent", Array.isArray(filter) ? filter : [filter]]);
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line path-alias/no-relative
|
||||
import { filters, mapMangledModuleLazy, waitFor, wreq } from "../webpack";
|
||||
import { filters, mapMangledModuleLazy, waitFor, wreq } from "@webpack";
|
||||
|
||||
import type * as t from "./types/menu";
|
||||
|
||||
export const Menu = {} as t.Menu;
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line path-alias/no-relative
|
||||
import { findByCodeLazy, findByPropsLazy, waitFor } from "../webpack";
|
||||
import { findByCodeLazy, findByPropsLazy, waitFor } from "@webpack";
|
||||
|
||||
export let React: typeof import("react");
|
||||
export let useState: typeof React.useState;
|
||||
|
|
|
|||
|
|
@ -16,10 +16,9 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { findByCodeLazy, findByPropsLazy } from "@webpack";
|
||||
import type * as Stores from "discord-types/stores";
|
||||
|
||||
// eslint-disable-next-line path-alias/no-relative
|
||||
import { findByCodeLazy, findByPropsLazy } from "../webpack";
|
||||
import { waitForStore } from "./internal";
|
||||
import * as t from "./types/stores";
|
||||
|
||||
|
|
@ -33,7 +32,7 @@ export let MessageStore: Omit<Stores.MessageStore, "getMessages"> & GenericStore
|
|||
getMessages(chanId: string): any;
|
||||
};
|
||||
|
||||
// this is not actually a FluxStore
|
||||
// TODO: The correct name for this is ChannelActionCreators and it has already been exported again from utils. Remove this export once enough time has passed
|
||||
export const PrivateChannelsStore = findByPropsLazy("openPrivateChannel");
|
||||
export let PermissionStore: GenericStore;
|
||||
export let GuildChannelStore: GenericStore;
|
||||
|
|
@ -86,4 +85,8 @@ waitForStore("GuildChannelStore", m => GuildChannelStore = m);
|
|||
waitForStore("MessageStore", m => MessageStore = m);
|
||||
waitForStore("WindowStore", m => WindowStore = m);
|
||||
waitForStore("EmojiStore", m => EmojiStore = m);
|
||||
waitForStore("ThemeStore", m => ThemeStore = m);
|
||||
waitForStore("ThemeStore", m => {
|
||||
ThemeStore = m;
|
||||
// Importing this directly can easily cause circular imports. For this reason, use a non import access here.
|
||||
Vencord.QuickCss.initQuickCssThemeStore();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,16 +16,15 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { _resolveReady, filters, findByCodeLazy, findByPropsLazy, findLazy, mapMangledModuleLazy, waitFor } from "@webpack";
|
||||
import type { Channel } from "discord-types/general";
|
||||
|
||||
// eslint-disable-next-line path-alias/no-relative
|
||||
import { _resolveReady, filters, findByCodeLazy, findByPropsLazy, findLazy, mapMangledModuleLazy, waitFor } from "../webpack";
|
||||
import type * as t from "./types/utils";
|
||||
|
||||
export let FluxDispatcher: t.FluxDispatcher;
|
||||
waitFor(["dispatch", "subscribe"], m => {
|
||||
FluxDispatcher = m;
|
||||
// Non import call to avoid circular dependency
|
||||
// Non import access to avoid circular dependency
|
||||
Vencord.Plugins.subscribeAllPluginsFluxEvents(m);
|
||||
|
||||
const cb = () => {
|
||||
|
|
@ -35,7 +34,7 @@ waitFor(["dispatch", "subscribe"], m => {
|
|||
m.subscribe("CONNECTION_OPEN", cb);
|
||||
});
|
||||
|
||||
export let ComponentDispatch;
|
||||
export let ComponentDispatch: any;
|
||||
waitFor(["dispatchToLastSubscribed"], m => ComponentDispatch = m);
|
||||
|
||||
export const Constants: t.Constants = mapMangledModuleLazy('ME:"/users/@me"', {
|
||||
|
|
@ -177,6 +176,7 @@ export const MessageActions = findByPropsLazy("editMessage", "sendMessage");
|
|||
export const MessageCache = findByPropsLazy("clearCache", "_channelMessages");
|
||||
export const UserProfileActions = findByPropsLazy("openUserProfileModal", "closeUserProfileModal");
|
||||
export const InviteActions = findByPropsLazy("resolveInvite");
|
||||
export const ChannelActionCreators = findByPropsLazy("openPrivateChannel");
|
||||
|
||||
export const IconUtils: t.IconUtils = findByPropsLazy("getGuildBannerURL", "getUserAvatarURL");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue