question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected behavior with Promise.all when Promise is polyfilled by babel-polyfill/core-js.

See original GitHub issue

https://github.com/webmixedreality/exokit/pull/470#issuecomment-421528903

https://glitch.com/edit/#!/leaf-anchovy?path=index.html:1:0

Promise.all never resolves.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Hello, WebVR! • A-Frame</title>
    <meta name="description" content="Hello, WebVR! • A-Frame">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.0.0/polyfill.js"></script>
    <script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>
    <script>
      var promise = new Promise(resolve => {
        setTimeout(() => { resolve(); }, 1000);  
      });
      
      Promise.all([promise]).then(() => { console.log('Promise.all resolved.'); });
    </script>
  </head>
  <body>
    <a-scene background="color: #ECECEC">
      <a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9" shadow></a-box>
      <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E" shadow></a-sphere>
      <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D" shadow></a-cylinder>
      <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4" shadow></a-plane>
    </a-scene>
  </body>
</html>

With things like this it could betray a different more fundamental issue, such as async resource callbacks not inducing libUV to tick, so I’d rather understand what’s happening than forcefully override it.

Source of the polyfill: https://raw.githubusercontent.com/zloirock/core-js/master/packages/core-js/modules/es.promise.js

I see it has some async calls in this microtask library: https://raw.githubusercontent.com/zloirock/core-js/master/packages/core-js/internals/microtask.js and https://raw.githubusercontent.com/zloirock/core-js/master/packages/core-js/internals/task.js

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ngokevincommented, Sep 15, 2018

Perhaps it should only do the ownerDocument check if the document is what is being observed. I’ll try to update and test.

0reactions
avaercommented, Sep 15, 2018

Isn’t that test case failing in chrome?

I copy-pasted it here: https://glitch.com/edit/#!/chestnut-crocodile

All three cases (children, attribute, characterData) seem to get triggered for non-attached nodes:

capture3

But maybe I’m misunderstanding something.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Promise.all() - JavaScript - MDN Web Docs
The Promise.all() method takes an iterable of promises as input and returns a single Promise. This returned promise fulfills when all of the ......
Read more >
Unexpected Promise.all() fail fast behavior - Stack Overflow
Promise.all is rejected if any of the elements are rejected. For example, if you pass in four promises that resolve after a timeout...
Read more >
zloirock/core-js: Standard Library - GitHub
Modular standard library for JavaScript. Includes polyfills for ECMAScript up to 2023: promises, symbols, collections, iterators, typed arrays, many other ...
Read more >
An in depth explanation of Promise.all and comparison with ...
We will find out what exactly they do, what are the differences between them and even how we could create our own polyfill...
Read more >
4. Using Libraries and Frameworks - JavaScript with Promises ...
js, and it is available as an npm package for use in Node.js. The Bluebird Promise object can serve as a drop-in replacement...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found