diff --git a/src/utils/lazyReact.tsx b/src/utils/lazyReact.tsx index 0e929aa98..14654406a 100644 --- a/src/utils/lazyReact.tsx +++ b/src/utils/lazyReact.tsx @@ -19,16 +19,20 @@ export const NoopComponent = () => null; export function LazyComponent(factory: () => React.ComponentType, attempts = 5) { const get = makeLazy(factory, attempts); - let failed = false; const LazyComponent = (props: T) => { - const Component = get() ?? (() => { - if (!failed) { - failed = true; - console.error(`LazyComponent factory failed:\n${factory}`); - } + let Component = (() => { + console.error(`LazyComponent factory failed:\n\n${factory}`); return NoopComponent; - })(); + })() as React.ComponentType; + + // @ts-ignore + if (!get.$$vencordLazyFailed()) { + const result = get(); + if (result != null) { + Component = result; + } + } return ; };