From 043675f3f8e70d41484b8af11c9f475995ad5801 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sat, 4 May 2024 23:56:02 -0300 Subject: [PATCH] Forgot to change this --- src/utils/lazyReact.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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 ; };