-
Notifications
You must be signed in to change notification settings - Fork 643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Promise.allSettled and Promise.any is undefined #766
Comments
Promise.allSettled is undefined in React-Native 0.68.2 with hermes enabled. Any solution to this? |
you need to install and apply custom polyfill for that methods |
@SMKH-PRO also be careful with these polyfills As their size too big( it's better to use something lighter |
@retyui theres nothing lighter that’s also correct, and correctness is much more important. Also, you’re using sizes from bundlephobia, which is FUD because in an actual application it won’t be anywhere near that large. |
actually no, for example 25 lines pollyfill for
|
@retyui and those 25 lines are incorrect, per spec. They also break if This thread isn't the place to debate it, though. |
|
Summary: `promise` module diff: [`8.2.0...8.3.0`](https://npmfs.com/compare/promise/8.2.0/8.3.0/) - Hermes issue: facebook/hermes#766 ## Changelog [General] [Added] - Added support `Promise.any` X-link: facebook/react-native#35080 Reviewed By: cortinico Differential Revision: D40681373 Pulled By: jacdebug fbshipit-source-id: ecd589186483f3aa0f48da28a1f6dfcb1e26c8bc
Summary: `promise` module diff: [`8.2.0...8.3.0`](https://npmfs.com/compare/promise/8.2.0/8.3.0/) - Hermes issue: facebook/hermes#766 ## Changelog [General] [Added] - Added support `Promise.any` Pull Request resolved: #35080 Test Plan: Release notes [`promise@8.3.0`](https://github.com/then/promise/releases/tag/8.3.0) ```tsx typeof Promise.any // function ``` Reviewed By: cortinico Differential Revision: D40681373 Pulled By: jacdebug fbshipit-source-id: ecd589186483f3aa0f48da28a1f6dfcb1e26c8bc
Summary: `promise` module diff: [`8.2.0...8.3.0`](https://npmfs.com/compare/promise/8.2.0/8.3.0/) - Hermes issue: facebook/hermes#766 ## Changelog [General] [Added] - Added support `Promise.any` Pull Request resolved: #35080 Test Plan: Release notes [`promise@8.3.0`](https://github.com/then/promise/releases/tag/8.3.0) ```tsx typeof Promise.any // function ``` Reviewed By: cortinico Differential Revision: D40681373 Pulled By: jacdebug fbshipit-source-id: ecd589186483f3aa0f48da28a1f6dfcb1e26c8bc # Conflicts: # package.json # yarn.lock
Re open issue: |
So, a bit of context for how we handle Promise. We actually do use a modified version of a polyfill, based on this implementation. So, Hermes actually has had support for So, this does make sense that they have not made their way into the most recent versions of RN, at least specifically for |
@retyui So to follow up, this behavior you are experiencing is expected for the version you are using. RN 0.70 was first cut on Jul 15th. RN 0.71 is not fully released yet, but the first release candidate was cut on Nov 3rd. Therefore, you can expect |
got it, should be fixed in react-native@0.71.x |
I have tested with Promise.allSettled([]) -[TypeError: undefined is not a function] |
@n-kulic as mentioned above, this feature is available in RN versions 0.71 and newer. Version 0.70.6 is older than the minimum version that supports this feature. |
Summary: `promise` module diff: [`8.2.0...8.3.0`](https://npmfs.com/compare/promise/8.2.0/8.3.0/) - Hermes issue: facebook/hermes#766 ## Changelog [General] [Added] - Added support `Promise.any` Pull Request resolved: facebook#35080 Test Plan: Release notes [`promise@8.3.0`](https://github.com/then/promise/releases/tag/8.3.0) ```tsx typeof Promise.any // function ``` Reviewed By: cortinico Differential Revision: D40681373 Pulled By: jacdebug fbshipit-source-id: ecd589186483f3aa0f48da28a1f6dfcb1e26c8bc
@leeyyl as you can see here hermes/lib/InternalBytecode/01-Promise.js Line 331 in eaf662b
|
@tmikov So how to use the
|
@leeyyl As I explained, Promise.allSettled has been available in Hermes since September 2022. Download any version of Hermes, compile and run the CLI and see for yourself. Which version of Hermes is packaged with each RN release is an orthogonal question. You might be using a version of RN without it, or there might be a polyfill that is overwriting Promise, or something else could be wrong in your setup. We are unable to investigate problems that are outside of Hermes, so consider filing an issue with React Native. They might know what is going on, might be able to pick this change in one of their point releases, etc. |
That super weird that a fresh method from ES2022
Object.hasOwn
was implemented, but methods of perv. ecmascript spec not implemented yet:Promise.allSettled(...) // ES2020
Promise.any(...) // ES2021
Bug Description
gradle clean
and confirmed this bug does not occur with JSCHermes version: 0.11.0
React Native version (if any): 0.69.0
OS version (if any): Android 11
Platform: arm64-v8a, armeabi-v7a, x86, x86_64
Steps To Reproduce
The Expected Behavior
The text was updated successfully, but these errors were encountered: