Fix waitFor initial finds traces getting logged to the console even though they always fail

This commit is contained in:
Nuckyz 2024-03-07 09:36:59 -03:00
parent 42a9fa2d47
commit 980206d315
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -475,8 +475,10 @@ export function waitFor(filter: string | string[] | FilterFn, callback: Callback
else if (typeof filter !== "function") else if (typeof filter !== "function")
throw new Error("filter must be a string, string[] or function, got " + typeof filter); throw new Error("filter must be a string, string[] or function, got " + typeof filter);
const [existing, id] = find(filter!, { isIndirect: true, isWaitFor: true }); if (cache != null) {
if (existing) return void callback(existing, id); const [existing, id] = find(filter, { isIndirect: true, isWaitFor: true });
if (existing) return void callback(existing, id);
}
subscriptions.set(filter, callback); subscriptions.set(filter, callback);
} }