fix(metro): proxies when unindexed
This commit is contained in:
parent
e70f598306
commit
8bbf1dbf5e
2 changed files with 5 additions and 3 deletions
|
|
@ -8,12 +8,12 @@ import {
|
|||
function shim<T extends (...args: any) => any>(fn: T) {
|
||||
return function shimmed(this: any, ...args: Parameters<T>) {
|
||||
const proxyInfo = getFindProxyInfo(args[1]);
|
||||
if (proxyInfo && !proxyInfo.cache) {
|
||||
if (proxyInfo && !proxyInfo.cache && proxyInfo.indexed) {
|
||||
let cancel = false;
|
||||
let unpatch = () => cancel = true;
|
||||
proxyInfo.subscribe(exp => {
|
||||
args[1] = exp;
|
||||
if (cancel) return;
|
||||
args[1] = exp;
|
||||
unpatch = fn.apply(this, args);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@ interface FindProxyInfo<A extends unknown[]> {
|
|||
}
|
||||
|
||||
function getIndexedSingleFind<A extends unknown[]>(filter: FilterFn<A>) {
|
||||
const id = Object.keys(getMetroCache().findIndex[filter.uniq]!).filter(k => k !== "_")[0];
|
||||
const modulesMap = getMetroCache().findIndex[filter.uniq];
|
||||
if (!modulesMap) return;
|
||||
const id = Object.keys(modulesMap).filter(k => k !== "_")[0];
|
||||
return id ? Number(id) : void 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue