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];
|
const mod = cache[key];
|
||||||
if (!mod?.loaded || mod?.exports == null) continue;
|
if (!mod?.loaded || mod?.exports == null) continue;
|
||||||
|
|
||||||
if (filter.$$vencordIsFactoryFilter && filter(wreq.m[key])) {
|
if (filter.$$vencordIsFactoryFilter) {
|
||||||
return { result: mod.exports, id: key, exportKey: null, factory: wreq.m[key] as AnyModuleFactory };
|
if (filter(wreq.m[key])) {
|
||||||
|
return { result: mod.exports, id: key, exportKey: null, factory: wreq.m[key] as AnyModuleFactory };
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter(mod.exports)) {
|
if (filter(mod.exports)) {
|
||||||
|
@ -692,8 +696,12 @@ export function cacheFindAll(filter: FilterFn) {
|
||||||
const mod = cache[key];
|
const mod = cache[key];
|
||||||
if (!mod?.loaded || mod?.exports == null) continue;
|
if (!mod?.loaded || mod?.exports == null) continue;
|
||||||
|
|
||||||
if (filter.$$vencordIsFactoryFilter && filter(wreq.m[key])) {
|
if (filter.$$vencordIsFactoryFilter) {
|
||||||
ret.push(mod.exports);
|
if (filter(wreq.m[key])) {
|
||||||
|
ret.push(mod.exports);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter(mod.exports)) {
|
if (filter(mod.exports)) {
|
||||||
|
@ -760,11 +768,14 @@ export const cacheFindBulk = traceFunction("cacheFindBulk", function cacheFindBu
|
||||||
const filter = filters[i];
|
const filter = filters[i];
|
||||||
if (filter == null) continue;
|
if (filter == null) continue;
|
||||||
|
|
||||||
if (filter.$$vencordIsFactoryFilter && filter(wreq.m[key])) {
|
if (filter.$$vencordIsFactoryFilter) {
|
||||||
results[i] = mod.exports;
|
if (filter(wreq.m[key])) {
|
||||||
filters[i] = undefined;
|
results[i] = mod.exports;
|
||||||
|
filters[i] = undefined;
|
||||||
|
|
||||||
|
if (++found === length) break outer;
|
||||||
|
}
|
||||||
|
|
||||||
if (++found === length) break outer;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -322,9 +322,12 @@ function wrapAndPatchFactory(id: PropertyKey, originalFactory: AnyModuleFactory)
|
||||||
|
|
||||||
for (const [filter, callback] of waitForSubscriptions) {
|
for (const [filter, callback] of waitForSubscriptions) {
|
||||||
try {
|
try {
|
||||||
if (filter.$$vencordIsFactoryFilter && filter(wrappedFactory.$$vencordOriginal!)) {
|
if (filter.$$vencordIsFactoryFilter) {
|
||||||
waitForSubscriptions.delete(filter);
|
if (filter(wrappedFactory.$$vencordOriginal!)) {
|
||||||
callback(exports, { id, exportKey: null, factory: wrappedFactory.$$vencordOriginal! });
|
waitForSubscriptions.delete(filter);
|
||||||
|
callback(exports, { id, exportKey: null, factory: wrappedFactory.$$vencordOriginal! });
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue