mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-27 01:36:24 +00:00
now it's right
This commit is contained in:
parent
0953ba89ed
commit
a6971289ad
2 changed files with 4 additions and 3 deletions
|
@ -11,6 +11,7 @@ export const SYM_LAZY_COMPONENT_INNER = Symbol.for("vencord.lazyComponent.inner"
|
||||||
export type LazyComponentType<P extends AnyRecord = AnyRecord> = React.FunctionComponent<P> & AnyRecord & {
|
export type LazyComponentType<P extends AnyRecord = AnyRecord> = React.FunctionComponent<P> & AnyRecord & {
|
||||||
[SYM_LAZY_COMPONENT_INNER]: () => AnyComponentType<P> | null;
|
[SYM_LAZY_COMPONENT_INNER]: () => AnyComponentType<P> | null;
|
||||||
};
|
};
|
||||||
|
export type AnyLazyComponentType<P extends AnyRecord> = LazyComponentType<P & AnyRecord>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A lazy component. The factory method is called on first render.
|
* A lazy component. The factory method is called on first render.
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { makeLazy, proxyLazy } from "@utils/lazy";
|
import { makeLazy, proxyLazy } from "@utils/lazy";
|
||||||
import { LazyComponent, LazyComponentType, SYM_LAZY_COMPONENT_INNER } from "@utils/lazyReact";
|
import { AnyLazyComponentType, LazyComponent, SYM_LAZY_COMPONENT_INNER } from "@utils/lazyReact";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import { canonicalizeMatch } from "@utils/patches";
|
import { canonicalizeMatch } from "@utils/patches";
|
||||||
import { proxyInner, SYM_PROXY_INNER_GET, SYM_PROXY_INNER_VALUE } from "@utils/proxyInner";
|
import { proxyInner, SYM_PROXY_INNER_GET, SYM_PROXY_INNER_VALUE } from "@utils/proxyInner";
|
||||||
|
@ -171,11 +171,11 @@ function printFilter(filter: FilterFn) {
|
||||||
return String(filter);
|
return String(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
function wrapWebpackComponent<P extends AnyRecord>(err: string | (() => string)): [WrapperComponent: LazyComponentType<P>, setInnerComponent: (rawComponent: any, parsedComponent: React.ComponentType<P>) => void] {
|
function wrapWebpackComponent<P extends AnyRecord>(err: string | (() => string)): [WrapperComponent: AnyLazyComponentType<P>, setInnerComponent: (rawComponent: any, parsedComponent: React.ComponentType<P>) => void] {
|
||||||
let InnerComponent = null as AnyComponentType<P> | null;
|
let InnerComponent = null as AnyComponentType<P> | null;
|
||||||
|
|
||||||
let findFailedLogged = false;
|
let findFailedLogged = false;
|
||||||
const WrapperComponent: LazyComponentType<P> = function (props) {
|
const WrapperComponent: AnyLazyComponentType<P> = function (props) {
|
||||||
if (InnerComponent === null && !findFailedLogged) {
|
if (InnerComponent === null && !findFailedLogged) {
|
||||||
findFailedLogged = true;
|
findFailedLogged = true;
|
||||||
logger.error(typeof err === "string" ? err : err());
|
logger.error(typeof err === "string" ? err : err());
|
||||||
|
|
Loading…
Reference in a new issue