for real now

This commit is contained in:
Nuckyz 2024-08-03 16:32:28 -03:00
parent f05d462a73
commit b22d4622ed
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 3 additions and 3 deletions

View file

@ -17,7 +17,7 @@ export const SYM_LAZY_COMPONENT_INNER = Symbol.for("vencord.lazyComponent.inner"
* @param attempts How many times to try to get the component before giving up
* @returns Result of factory function
*/
export function LazyComponent<T extends object = any>(factory: () => LazyComponentType<T>, attempts = 5) {
export function LazyComponent<T extends object = any>(factory: () => LazyComponentType<T>, attempts = 5, errMsg: string | (() => string) = `LazyComponent factory failed:\n\n${factory}`) {
const get = makeLazy(factory, attempts, { isIndirect: true });
let InnerComponent = null as LazyComponentType<T> | null;
@ -37,7 +37,7 @@ export function LazyComponent<T extends object = any>(factory: () => LazyCompone
lazyFailedLogged = true;
}
console.error(`LazyComponent factory failed:\n\n${factory}`);
console.error(typeof errMsg === "string" ? errMsg : errMsg());
}
return InnerComponent && <InnerComponent {...props} />;

View file

@ -588,7 +588,7 @@ export function webpackDependantLazy<T = any>(factory: () => T, attempts?: numbe
export function webpackDependantLazyComponent<T extends object = any>(factory: () => any, attempts?: number) {
if (IS_REPORTER) webpackSearchHistory.push(["webpackDependantLazyComponent", [factory]]);
return LazyComponent<T>(factory, attempts);
return LazyComponent<T>(factory, attempts, `Webpack dependant LazyComponent factory failed:\n\n${factory}`);
}
export const DefaultExtractAndLoadChunksRegex = /(?:(?:Promise\.all\(\[)?(\i\.e\("?[^)]+?"?\)[^\]]*?)(?:\]\))?|Promise\.resolve\(\))\.then\(\i\.bind\(\i,"?([^)]+?)"?\)\)/;