@gentholb & I stumbled on a tenacious problem yesterday, and after hours trying and succeeding in fixing it, we thought it would be interesting to document it here. The issue can be closed if need be.
The problem
When rehydrating, the arrays in our Redux store would be substituted by Immutable Maps.
Instead of this:
entities: [
{ index: 1 },
{ index: 2 }
]
The following structure was loaded into the store:
entities: {
0: { index: 1 },
1: { index: 2 }
}
This was breaking our app since we were using #Array.findIndex in our reducer, which does not work with Maps.
Migrated to the @actra-development-oss/redux-persist-transform-filter-immutable version of the plugin, which is the one linked from the README (but unfortunately not the one registered on NPM…), which declares immutable@3.8.2 as a dependency
Hi!
@gentholb & I stumbled on a tenacious problem yesterday, and after hours trying and succeeding in fixing it, we thought it would be interesting to document it here. The issue can be closed if need be.
The problem
When rehydrating, the arrays in our Redux store would be substituted by Immutable Maps.
Instead of this:
The following structure was loaded into the store:
This was breaking our app since we were using
#Array.findIndex
in our reducer, which does not work with Maps.I had the following dependencies in my app :
The solution
It turns out that the problem has been documented here and is caused by multiple Immutable versions being loaded in the app.
The https://github.com/ntucker/redux-persist-transform-filter-immutable library declares immutable@4.0.0-rc.7 as a dependency, which was causing Immutable to be loaded twice.
We then :
@actra-development-oss/redux-persist-transform-filter-immutable
version of the plugin, which is the one linked from the README (but unfortunately not the one registered on NPM…), which declaresimmutable@3.8.2
as a dependencyHope this can help!
Thanks