diff --git a/src/utils/lazy.ts b/src/utils/lazy.ts index 4a8557d0f..a98e56f45 100644 --- a/src/utils/lazy.ts +++ b/src/utils/lazy.ts @@ -9,16 +9,16 @@ export function makeLazy(factory: () => T, attempts = 5): () => T { let cache: T; const getter = () => { - if (!cache && attempts > tries++) { + if (!cache && attempts > tries) { cache = factory(); - if (!cache && attempts === tries) { + if (!cache && attempts === ++tries) { console.error(`Lazy factory failed:\n\n${factory}`); } } return cache; }; - getter.$$vencordLazyFailed = () => tries >= attempts; + getter.$$vencordLazyFailed = () => tries === attempts; return getter; } diff --git a/src/utils/lazyReact.tsx b/src/utils/lazyReact.tsx index 14654406a..f7f6b0ff0 100644 --- a/src/utils/lazyReact.tsx +++ b/src/utils/lazyReact.tsx @@ -23,15 +23,13 @@ export function LazyComponent(factory: () => React.Compo let Component = (() => { console.error(`LazyComponent factory failed:\n\n${factory}`); - return NoopComponent; - })() as React.ComponentType; + return null; + }) as React.ComponentType; // @ts-ignore if (!get.$$vencordLazyFailed()) { const result = get(); - if (result != null) { - Component = result; - } + if (result != null) Component = result; } return ;