ImmutableJS fromJS call not working

The docs say “If you are using the Immutable-js in your web app, instead of the Immutable.Map() , call the Immutable.fromJS() which converts deeply nested objects to an Immutable Map .” ( but the fromJS call on SendBird objects just returns a plain object. I have no issues with ImmutableJS outside of this issue, our entire redux store uses it.

Anything I am missing here?

Just to prove what I am seeing here are is an image:

You can see calling fromJS is not turning the object immutable.

Hi There,

The purpose of using immutable JS is to make deep copies of the channel objects as they are mutable by nature. I found this particularly important if trying to keep within the bounds of Redux.

I’m not quite clear what the issue is. Your screen short doesn’t indicate if the fromJS channel objects is a deep copy of the first channel object.

One thing to note, not all sendbird channel objects inherit from the parent SDK. If you fetch a particular channel or a list of channels they will inherit the methods of the parent SDK. However, if the channel object originates from a channel event handler then you only have access to its data and not any prototypes.

The problem is that the fromJS call is performing the deep copy but returning a plain object instead of an immutable object.

When you create an immutable object like this:

const obj1 = fromJS({ test1: { test2: 'test' } });

You can access inner objects with:


And you will get an immutable Map back:
Screen Shot 2020-06-02 at 4.22.13 PM

The problem is that when using fromJS on a SendBird object like this where action.conversation is returned from the SendBird JS client:

const obj = fromJS({ conversation: action.conversation });

and then trying to access it with this:


You get a deep copy of the object but it is not an immutable object, instead just a plain object (see image in next post)

Screen Shot 2020-06-02 at 4.24.05 PM

I looked a bit deeper and I was able to solve it from this StackOverflow post: but that removes the prototypes which is obviously not ideal so I will need to keep the SendBird objects as plain objects in my redux store.