Promises hang on empty selection result
See original GitHub issuevar promise = $.Velocity.animate($('.something-not-exist'), { duration: 100 });
I’m expecting the returned promise
to be completed with either a success or a rejection, but it ends up being pending forever.
Personally, I prefer the promise to be resolved immediately in this case.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
Promise.all([]) returns a resolved promise, but Promise.race ...
It's defined in the docs (race): "If the iterable passed is empty, the promise returned will be forever pending." Promise.all docs: "If an...
Read more >Promise - JavaScript - MDN Web Docs
The Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value.
Read more >Biden Promise Tracker | PolitiFact
The Biden Promise Tracker monitors the 100 most important campaign promises of President Joseph R. Biden, elected in November 2020. Biden said his...
Read more >typescript-eslint/no-floating-promises.md at main - GitHub
Floating Promises can cause several issues, such as improperly sequenced operations, ignored Promise rejections, and more.
Read more >Use Promise.all to Stop Async/Await from Blocking Execution ...
Let's refactor the code we've written so far in this article using async functions to make it a little easier to read: async...
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
Promises should always resolve one way or another - my personal view is that this should succeed as we don’t know if being passed an empty NodeList is deliberate or not - possibly add an option to
rejectEmptyPromise
or similar though?@Rycochet Sure, no problem. I copy-pasted last minute before leaving work. It’s basically the same code you have in your documentation.
And I am 100% sure that it stops after $element2 because it return an empty NodeList. When I have more time today, I will put together a JSFiddle together.
Thank you for your quick response.