Skip to content

IE11 fromJS bug #1648

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

Closed
rytisbac opened this issue Nov 14, 2018 · 8 comments · Fixed by #1833
Closed

IE11 fromJS bug #1648

rytisbac opened this issue Nov 14, 2018 · 8 comments · Fixed by #1833
Labels
Milestone

Comments

@rytisbac
Copy link

Version v4.0.0-rc.12
Function fromJS.
example:
console.log(fromJS({test: 'qqq'}))
In most of the browsers it returns Map object, but IE11 returns the same object.
Other case:
console.log(fromJS([{test: 'qqq'}]))
In most of the browsers it returns List and Map as first element, but IE11 returns List and initial object.

Version 3.8.2 works as expected

@thenano
Copy link

thenano commented Dec 14, 2018

Any chance this will be addressed? It completely broke my application on internet explorer as I use fromJS a lot.
I can confirm that the issue was introduced with 4.0.0-rc10, up to 4.0.0-rc9 everything works fine

@cauethenorio
Copy link

cauethenorio commented Dec 18, 2018

@thenano I had the same issue and was able to fix it installing the core-js es6.function.name polyfill.

EDIT: A little bit more of context:

After #1627, Immutable.fromJS function checks if the object to be transformed is a plain object using value.constructor.name === 'Object' which fails in IE since IE doesn't supports function.name. The polyfill allows the code to read functions name in IE.

@yuya-sato-geniee
Copy link

List structure seems to be broken by using .concat() on IE11 on 4.0.0-rc.12.

But v3.8.2 works good.

Is it related to this issue?

How to reproduce

Please open below by IE11.

http://another.geniee.jp/test/ysato/immutable-bug/map.html

var MyRecord = Immutable.Record({a: 1});
var list = Immutable.List([]);
list = list.concat([new MyRecord({a: 2}), new MyRecord({a: 3})]);
console.log(JSON.stringify(list)); 
// from Chrome: [{"a":2},{"a":3}]
// from IE11: [[{"a":2},{"a":3}]]     <- it is incorrect

@sjfkai
Copy link

sjfkai commented Jan 9, 2019

I had the same issue with fromJS

@hiyangguo
Copy link

Me too. And when I execute the code :

Immutable.fromJS({a:1}).toJS()

In IE 11 ,it will throw exception Object don't support "toJS" prop or function,but in chrome it is work ok.

package.json

"immutable": "^4.0.0-rc.12",

@hiyangguo
Copy link

But when I use the

"immutable": "^3.8.1"

It is work ok.

@alexmassicott
Copy link

alexmassicott commented Dec 26, 2019

@cauethenorio You're the real mvp, the es6.function.name fixed it for me.

@jdeniau
Copy link
Member

jdeniau commented Jun 29, 2021

Thank you for your bug report. The immutable-js oss fork will soon be merged and a fix for this issue has been included in #1833. Once this PR is merged, this issue will be resolved in the main branch. We will then do our best to to release the 4.0.0 version.

Commit reference: f3a6d5c

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

Successfully merging a pull request may close this issue.

9 participants