Merge branch 'immediate-finds' into immediate-finds-modules-proxy
This commit is contained in:
commit
6213fca9ed
|
@ -637,8 +637,12 @@ 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])) {
|
||||
return { result: mod.exports, id: key, exportKey: null, factory: wreq.m[key] as AnyModuleFactory };
|
||||
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)) {
|
||||
|
@ -692,8 +696,12 @@ export function cacheFindAll(filter: FilterFn) {
|
|||
const mod = cache[key];
|
||||
if (!mod?.loaded || mod?.exports == null) continue;
|
||||
|
||||
if (filter.$$vencordIsFactoryFilter && filter(wreq.m[key])) {
|
||||
ret.push(mod.exports);
|
||||
if (filter.$$vencordIsFactoryFilter) {
|
||||
if (filter(wreq.m[key])) {
|
||||
ret.push(mod.exports);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (filter(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])) {
|
||||
results[i] = mod.exports;
|
||||
filters[i] = undefined;
|
||||
if (filter.$$vencordIsFactoryFilter) {
|
||||
if (filter(wreq.m[key])) {
|
||||
results[i] = mod.exports;
|
||||
filters[i] = undefined;
|
||||
|
||||
if (++found === length) break outer;
|
||||
}
|
||||
|
||||
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!)) {
|
||||
waitForSubscriptions.delete(filter);
|
||||
callback(exports, { id, exportKey: null, factory: 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