New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for async waitForTarget #7885
Conversation
Does it make sense to use debugError instead of console.error? |
@OrKoN Hello, I do not understand, what does this have to do with |
Apologies, ignore that, I intended to leave that comment on #7883 |
The timeout setting is not respected if the callback never resolves or takes a long time to resolve. Could you address that? also, the firefox-related failures probably require |
Sorry, the test was copied from this one, so it should use Lines 70 to 86 in 921e4e6
|
Promise.race([ | ||
targetPromise, | ||
(async () => { | ||
for (const target of this.targets()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh, additional edge cases come to mind. WDYT about the following: we start waiting for a target and start checking existing targets one by one (and say there is a hundred of targets), then a matching target gets created and we resolve the waitForTarget with it. Although we resolved the inner promise continues executing and keeps checking the remaining targets one by one. I think that should be addressed by checking if the waitWithTimeout has been resolved and returning earlier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think let's leave this for a follow-up (seems to be rather an edge case)
What kind of change does this PR introduce?
feature
Did you add tests for your changes?
yes
If relevant, did you update the documentation?
yes
Summary
sometimes we need to call
waitForTarget
in async:Does this PR introduce a breaking change?
no
Other information