You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Immutable 4.0.0-rc.9, a Map containing a plain object with a length: <number> property gets converted via toJS() to an object containing only an array of that length, with any other properties removed.
What I expected to see was a plain object containing a plain object with all properties intact.
We ran into this issue dealing with the output produced by Draft's convertToRaw helper which produces a property called inlineStyleRanges which is an array of objects, all of which have a length: <number> property.
The text was updated successfully, but these errors were encountered:
jsibelman
changed the title
toJS() converts plain JS objects, with a length property, in an Immutable collection to an array (v4)
toJS() converts plain JS objects with a length property, in an Immutable collection, to an array (v4)
Nov 8, 2017
This issue is fixed in a fork I’m maintaining to help get v4 over the finish line. If you would find it useful, you can install a build now that includes the fix by replacing your immutable dependency string in package.json with:
What happened
Using Immutable
4.0.0-rc.9
, aMap
containing a plain object with alength: <number>
property gets converted viatoJS()
to an object containing only an array of that length, with any other properties removed.What I expected to see was a plain object containing a plain object with all properties intact.
We ran into this issue dealing with the output produced by Draft's
convertToRaw
helper which produces a property calledinlineStyleRanges
which is an array of objects, all of which have alength: <number>
property.How to reproduce
You can see it in action here:
https://codepen.io/jsibelman/pen/ooYJMX?editors=0012
The code:
The output seen in the console:
The text was updated successfully, but these errors were encountered: