Promise.all hangs
See original GitHub issueYour system information
- VelocityJS version: 2.0.2
- Browser: firefox 59.0.2 64-bit chrome 66.0.3359.139 64-bit
- Operating System: Arch linux
Checklist
- Is this an issue with code?: Yes
- Is this an issue with documentation?: No
- Have you reproduced this in other browsers?: only firefox and chrome, didn’t try others
- Have you checked for updates?: Using latest 2.x
- Have you checked for similar open issues?: Yes
Please remember that this is an issue tracker, support requests should be posted on StackOverflow - see CONTRIBUTING.md
Please describe your issue in as much detail as possible:
Describe what you expected should happen and what did happen.
Expected: I expected to use Promise.all(arrayOfAnimations)
without issue.
Actual: Browser freezes
Steps for reproducing this issue (code):
Here is a minimal jsfiddle for reproducing the bug
Below is the vue code I used to understand the issue a little better
- https://codesandbox.io/s/0472r20wjw
- click
[Good Animate]
to see the expected behavior - click
[Buggy Animate]
to freeze your browser
The difference between Good
and Buggy
is that Good calls then
on each animation before passing it through Promise.all
. I believe the issue has to do with the promise implementation - for some reason in 2.x the promises are really arrays which Promise.all doesn’t play well with.
Issue Analytics
- State:
- Created 5 years ago
- Comments:12
Top Results From Across the Web
Node.js Promise.all() hanging - javascript - Stack Overflow
The 1st callback to .then() is only for fulfillment (all resolved). You haven't provided anything to be done upon rejection, so it'll fail ......
Read more >A promise resolving with a promise causes infinite hang #19597
Nothing gets logged. Even after a hour. It turns out, that rather a Promise-like object (i.e. have a then method) (resolved by a ......
Read more >Use Promise.all to Stop Async/Await from Blocking Execution ...
Use Promise.all to Stop Async/Await from Blocking Execution in JS. When writing asynchronous code, async/await is a powerful tool — but it comes...
Read more >Methods of Promise: .all(), .any() , .finally(), .race()
The Promise.all() method accepts an iterable Object, such as an Array of promises as an input and returns a single promise that resolves...
Read more >How to safely await all promises in Javascript - flaming.codes
Using Promise.allSettled instead of Promise.all to safely await all promises, even if they throw an error.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ugh, not sure exactly what can be done about this one - it’s literally impossible to have them as real Promises, but they copy the important bits across into the returns so that they can be used as Thenables.
This is going to need a bit of thought to handle - my initial one being “supply a
Velocity.all([...anims])
” method that can handle passing both real Promises and Velocity results.Any ideas would be welcome 😃
Thanks!
I was using 2.0.4 indeed. I created a new issue and linked a JSFiddle that reproduces the problem.