immutable-js-oss/immutable-js

.get returns old value, .toJs returns new value

Closed this issue · 1 comments

From @dor6 on Fri, 24 Apr 2020 12:53:19 GMT

I get a new immutable map after using set (the value is an object) in the new map object when i use toJS (or just use console.info on it) i get the updated object, when I use get on the value i updated (which is an object btw) I get the old value.

I do the same action twice becuase i have the object twice, once in a list inside a context and once in a function that opens a modal base on this object. the update heppens inside the modal. the list updates just fine but the object inside the modal has the above problem.

My solution was cloning the object using "fromJS(object.toJS())".

My code is in react native, I cant share the code because of confidentiality.

Copied from original issue: immutable-js#1767

Addressed in original repo.