Skip to content
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

Ensure that pending requests doesn't resolve prematurely #210

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

jonaswalden
Copy link
Contributor

@jonaswalden jonaswalden commented Sep 26, 2024

// code.js
fetch("/fast-resource");
fetch("/slow-resource");
// test.js
await Promise.all(browser.window.fetch._pendingRequests);

Just pushing and popping the stack makes response of the /fast-resource pop the pending response for /slow-resource which causes the Promise.all() to resolve prematurely.

Having promises resolve with the arguments passed to fetch() is nice for debugging.

@jonaswalden jonaswalden requested a review from a team as a code owner September 26, 2024 09:39
@jonaswalden jonaswalden merged commit f1e6eb3 into master Sep 27, 2024
3 checks passed
@jonaswalden jonaswalden deleted the fix-pending-requests branch September 27, 2024 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants