Skip to content
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

Problem with MobX 5+ : Your environment doesn't support Symbol and Proxy objects. #28

Closed
talut opened this issue Jul 12, 2019 · 19 comments

Comments

@talut
Copy link

talut commented Jul 12, 2019

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

IMAGE 2019-07-12 14:50:25

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

@nazrdogan
Copy link

@talut
Copy link
Author

talut commented Jul 12, 2019

@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.

@terrysahaidak
Copy link

terrysahaidak commented Jul 13, 2019

A lot of people (including me) are using mobx and mst, so this is really sad Hermes excluded proxy from the support list.

@dulinriley
Copy link
Contributor

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.

@farwayer
Copy link
Contributor

farwayer commented Jul 13, 2019

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.

@kesha-antonov
Copy link

I'm using mobx too

@juliobetta
Copy link

That's a bummer... Using Proxy makes me feel so smart! 🤓

@mtford90
Copy link

Downgrading to MobX 4 has been rather painful for me what with the caveats listed here: https://mobx.js.org/best/pitfalls.html

bryanstearns added a commit to infinitered/ignite-bowser that referenced this issue Aug 17, 2019
…bility

We need to lock mobx at 4.x because of facebook/hermes#28 (as well as the
old version of JavaScriptCore in iOS 9 not supporting Proxies). We could
move to 5.x if we are okay with not supporting iOS 9 and Hermes, but we
don't think that's a viable path forward at this time.
@schumannd
Copy link

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

@terrysahaidak
Copy link

@schumannd V8 supports Proxy but you can't use it with RN

@schumannd
Copy link

schumannd commented Nov 8, 2019

@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.

@terrysahaidak
Copy link

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.

@mhorowitz
Copy link
Contributor

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)

@schumannd
Copy link

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.

facebook-github-bot pushed a commit that referenced this issue Dec 27, 2019
Summary:
GCC 7.4 (which is what GitHub Actions supports) is having trouble
compiling the latest trunk, even though we think it is valid C++14.
Pull Request resolved: facebookincubator/fbjni#28

Test Plan: OSS CI passes: https://github.com/facebookincubator/fbjni/commit/cb99a001c4d40e571ae2af5edd1753d9aa2ecba9/checks?check_suite_id=376297298

Reviewed By: swolchok

Differential Revision: D19239659

Pulled By: dreiss

fbshipit-source-id: 6e4724fa10f1367fdacf5f2f9a520dd6d98b30bf
@mrhitman
Copy link

What is better: downgrade mobx to 4v or disable hermes? What gives more profit?

@dulinriley
Copy link
Contributor

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.

@fengmingye
Copy link

What is better: downgrade mobx to 4v or disable hermes? Which gives more profit?

@talut
Copy link
Author

talut commented Dec 7, 2020

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.

@mhorowitz
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests