Problem with MobX 5+ : Your environment doesn't support Symbol and Proxy objects.
talut opened this issue ยท 19 comments
Problem: MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore., js engine: hermes
Reproducing the error:
react-native init HermesWithMobX
yarn add mobx --save
yarn add mobx-react-lite
project.ext.react = [
entryFile: "index.js",
enableHermes: true,
]
And I'm just using the MobX also you can look this repo for this example:
Example Repo: https://github.com/talut/mobx-with-hermes-example
@talut you can check this doc.its excluded. https://github.com/facebook/hermes/blob/master/doc/Features.md#excluded-from-support
@talut you can check this doc.its excluded. https://github.com/facebook/hermes/blob/master/doc/Features.md#excluded-from-support
Thanks for answer, I think thats a bad news. Fortunately I'm just using MobX for only experimental reasons. For real projects, my main structure built with Redux.
A lot of people (including me) are using mobx and mst, so this is really sad Hermes excluded proxy from the support list.
Does anyone know what specific features MobX requires Proxy for? If it's a small part of the library, we could submit a PR to avoid that check until it's necessary (and then perhaps most users of MobX will be unaffected).
If it's systemic to the library (and it is widely used), we'll talk about what it would take to enable Proxy. We have avoided it in the past because it is likely to cause a performance hit to a lot of object property reads/writes.
Note that the exception message includes a short-term mitigation, using MobX 4. Not sure if that will work for everybody.
For now I'll close this issue, as there's nothing we can do in the short term. Feel free to open another issue called "Implement Proxy" and include various use-cases in popular libraries such as MobX. That can be a long-running issue that we'll track and communicate how we might plan to implement it.
Does anyone know what specific features MobX requires Proxy for?
For object dynamic properties observing and for wrapping arrays. MobX@4 arrays could not work properly with some third-party libraries.
we could submit a PR to avoid that check until it's necessary
This PR will not be accepted. Using Proxy'es was deliberate decision. MobX@4 is official LTS for old js environments. In most cases downgrading to MobX@4 is ok.
But IMO Proxy should be supported in long-term.
I'm using mobx too
That's a bummer... Using Proxy
makes me feel so smart! ๐ค
Downgrading to MobX 4 has been rather painful for me what with the caveats listed here: https://mobx.js.org/best/pitfalls.html
Does anyone know if V8 supports Proxies? I am about to switch from JSC to either V8 or Hermes, and this might be the deciding factor
@schumannd V8 supports Proxy but you can't use it with RN
@terrysahaidak you can't use V8 with RN? or Proxy with RN? Because using V8 with RN60+ has been recommended to fix a recent severe bug
I have not tried it yet, so I can't say whether it actually works or not.
Wow, this is cool, I didn't know about this project. But still, if you're looking for just Proxy support you can stay at the JSC because the main point of Hermes (I think) is increasing TTI, v8 isn't really better on this.
We are investigating Proxy for Hermes, so that will be a solution at some point. I'm not ready to give a date, but progress is looking good. #33 (comment)
if you're looking for just Proxy support you can stay at the JSC
I am trying to fix this bug where the suggested fix is to switch to V8 or Hermes. So JSC is not an option. The bug is also pretty hard to reproduce so I don't want to take any chances.
What is better: downgrade mobx to 4v or disable hermes? What gives more profit?
See the most recent updates on issue #33 (comment)
Proxy is now enabled in Hermes, but not yet by default. See the instructions in that comment for enabling it and testing it out. Once we're more certain that there aren't bugs in the Proxy implementation we'll expose it by default.
What is better: downgrade mobx to 4v or disable hermes? Which gives more profit?
What is better: downgrade mobx to 4v or disable hermes? Which gives more profit?
I think Hermes has more profit. You can use Redux or directly the context api. Also Hermes will be available in IOS too. Hermes vs JSC benchmarks shows the reason to use. But you should ask for yourself "Do I need Mobx". If it's yes should use MobX and forgot the Hermes :) Such decisions should be made according to the project need.
downgrade mobx to 4v or disable hermes
Neither. Opt in to using hermes with Proxy support as described in #33 (comment). Then you can keep using MobX 5. Or, wait for RN 0.64, which works with Hermes v0.7, which has Proxy enabled by default.