Bootstrap with ImmutableUtil doesn't work
- Dominant language
- JavaScript
- Stars
- 3.4k
- Forks
- 312
- PR merge metrics
- No merged PRs in 30d
Description
Hey,
I'm using bootstrap with ImmutableUtil like this:
```
var immutableAlt = require('alt/utils/ImmutableUtil');
alt.createStore(immutableAlt(MyStore), 'MyStore');
```
and then with bootstrap like this:
```
alt.bootstrap(
JSON.stringify(
{ 'MyStore': { data: { prop1: 'a', prop2: 'b' } } }
, null, 3)
);
```
but the returned object from `MyStore.getState()` is the store without an option to get the data object.
I've resolved it by _not_ using ImmutableUtil and overriding onDeserialize like this:
```
onDeserialize: function (data) {
return { data: Immutable.fromJS(
data
) }
}
```
Contributor guide
Research direction
Start by reproducing the interaction between ImmutableUtil, createStore, and bootstrap using the snippets in the issue. Compare the resulting MyStore.getState() with the onDeserialize workaround; done means bootstrapped state exposes the data object while retaining ImmutableUtil support.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100