Merge branch 'immediate-finds' into immediate-finds-modules-proxy
This commit is contained in:
commit
6213fca9ed
|
@ -637,10 +637,14 @@ export const _cacheFind = traceFunction("cacheFind", function _cacheFind(filter:
|
|||
const mod = cache[key];
|
||||
if (!mod?.loaded || mod?.exports == null) continue;
|
||||
|
||||
if (filter.$$vencordIsFactoryFilter && filter(wreq.m[key])) {
|
||||
if (filter.$$vencordIsFactoryFilter) {
|
||||
if (filter(wreq.m[key])) {
|
||||
return { result: mod.exports, id: key, exportKey: null, factory: wreq.m[key] as AnyModuleFactory };
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (filter(mod.exports)) {
|
||||
return { result: mod.exports, id: key, exportKey: null, factory: wreq.m[key] as AnyModuleFactory };
|
||||
}
|
||||
|
@ -692,10 +696,14 @@ export function cacheFindAll(filter: FilterFn) {
|
|||
const mod = cache[key];
|
||||
if (!mod?.loaded || mod?.exports == null) continue;
|
||||
|
||||
if (filter.$$vencordIsFactoryFilter && filter(wreq.m[key])) {
|
||||
if (filter.$$vencordIsFactoryFilter) {
|
||||
if (filter(wreq.m[key])) {
|
||||
ret.push(mod.exports);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (filter(mod.exports)) {
|
||||
ret.push(mod.exports);
|
||||
}
|
||||
|
@ -760,11 +768,14 @@ export const cacheFindBulk = traceFunction("cacheFindBulk", function cacheFindBu
|
|||
const filter = filters[i];
|
||||
if (filter == null) continue;
|
||||
|
||||
if (filter.$$vencordIsFactoryFilter && filter(wreq.m[key])) {
|
||||
if (filter.$$vencordIsFactoryFilter) {
|
||||
if (filter(wreq.m[key])) {
|
||||
results[i] = mod.exports;
|
||||
filters[i] = undefined;
|
||||
|
||||
if (++found === length) break outer;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -322,9 +322,12 @@ function wrapAndPatchFactory(id: PropertyKey, originalFactory: AnyModuleFactory)
|
|||
|
||||
for (const [filter, callback] of waitForSubscriptions) {
|
||||
try {
|
||||
if (filter.$$vencordIsFactoryFilter && filter(wrappedFactory.$$vencordOriginal!)) {
|
||||
if (filter.$$vencordIsFactoryFilter) {
|
||||
if (filter(wrappedFactory.$$vencordOriginal!)) {
|
||||
waitForSubscriptions.delete(filter);
|
||||
callback(exports, { id, exportKey: null, factory: wrappedFactory.$$vencordOriginal! });
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue