loadable and unwrap were not updated to check for isPromiseLike and are broken in applications with zone.js #3065
Replies: 2 comments 4 replies
-
As discussed somewhere, it's intentional. Those promises have already created with What promise library do you use? Can you create a very small one-file reproduction with https://stackblitz.com? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the answer and your effort. As you can see here https://stackblitz.com/edit/zonejs-loadable-jotai?file=index.js Promise.resolve() instanceof Promise; // is true but const myPromise = (async () => {})(); // instance of the real Promise
myPromise instanceof Promise; // is false
myPromise instanceof Promise || myPromise instanceof (async () => {})().constructor; // is true https://www.npmjs.com/package/zone.js is overriding the global Promise class and is very adopted https://www.npmjs.com/package/zone.js?activeTab=dependents |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Bug Description
I saw the related discussion and pull request although I think loadable and unwrap didn't have their patch as intended
Can you have a look, please?
I know we have a solution here, but just to mention it is also possible to do
const isPromise = (x) => x instanceof Promise || x instanceof (async () => {})().constructor
which was what I did in my project with patch-package until nowReproduction Link
https://stackblitz.com/edit/zonejs-loadable-jotai?file=index.js
Beta Was this translation helpful? Give feedback.
All reactions