Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(runtime): issue with update-component and patched Promise (#4460)
This fixes an issue with a check used in `updateComponent` to enqueue asynchronous updates (implemented with async functions) to components. In particular, if the global `Promise` object is patched such that it is not equal to the native `Promise` object returned by, for instance, an `async` function, which will return the native, unpatched object even if `window.Promise` has been overwritten. A previous change in #4250 made a change such that we did a check like this: ```ts maybePromise instanceof Promise ``` The problem is that if `maybePromise` is the return value of an async function, like ```ts const foo = await something(); ``` and `window.Promise` has been overwritten then this check will unfortunately fail unexpectedly. The fix is just to first check `instanceof` and then add a duck-type-ey fallback as well.
- Loading branch information