Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

[Bug?] Error: IE11 does not support 'includes' method #698

Closed
SotaOishi opened this issue Jun 12, 2019 · 9 comments
Closed

[Bug?] Error: IE11 does not support 'includes' method #698

SotaOishi opened this issue Jun 12, 2019 · 9 comments

Comments

@SotaOishi
Copy link

Thanks for the update and maintaining the project.

In project(use inject and observer, Provider), I used this library.
When update 6.0.3 from 6.0.2, errors occured in IE11.

version
・node:10.15.3
・react:16.8.6
・mobx:4.3.1
・mobx-react:6.0.3

https://github.com/mobxjs/mobx-react/blob/master/src/utils/utils.js#L71
My guess is the issue is in the above link.

I try to replace Array.prototype.indexOf method from Array.prototype.includes method in my environment.
As a result, no errors occured.

Is this a bug or I'm I missing something?
Thanks in advance.

@danielkcz
Copy link
Contributor

You need to use a polyfill. Should be probably mentioned in docs, thanks for heads-up.

I recommend: https://polyfill.io

@SotaOishi
Copy link
Author

@FredyC
Thanks for your reply !
I'm sorry that my English isn't very good.

In actuality, i used babel@7 .
For example

.babelrc

{
"presets": [
    [
      "@babel/env",
      {
        "modules": false,
        "useBuiltIns": "usage",
        "corejs": 3
      }
    ],
    "@babel/react"
  ],
   ... other
}

I will need to reconfirm babel config.

I understood that this library not support IE11.
Is my understanding correct ... ?

@danielkcz
Copy link
Contributor

As long as you use MobX 4, it should be supported just fine. Don't use Babel for polyfill, that would be too big. That service I've mentioned detects and serves only polyfills that browser needs. You just need to add a script in your index.html.

<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js?features=Array.prototype.includes"></script>

@sergei-startsev
Copy link

From mobx-react docs:

Both mobx-react 5 and 6 are compatible with mobx 4 and 5

From mobx docs:

MobX version Actively supported Supported browsers
4.* Yes (LTS) Any ES5 compliant browser

I'm not sure mobx-react 6 is compatible with mobx 4 if it requires polyfills that mobx doesn't.

@mweststrate
Copy link
Member

@sergei-startsev it is mobx-react that is compatible with mobx 4. I don't see how IE 11 compatibility logically follows from that. (mobx-react@5 is also compatible with mobx 4, and compatible with IE 11, and React 0.13, which isn't the case for 6 either). The table is just state that one can use mobx-react@6 with mobx 4.

@FredyC I think in this specific case we can just change the code to protoProps.indexOf(key) !== -1 and restore compatibility. (it is not a goal, but if we can remove friction by such a trivial change lets do it)

@sergei-startsev
Copy link

@mweststrate At least it should be in the list of breaking changes like a note about React support.

@mweststrate
Copy link
Member

mweststrate commented Jun 17, 2019 via email

@mweststrate
Copy link
Member

Fix released as 6.0.4

@lock
Copy link

lock bot commented Jan 14, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants