Decide on approach to immutabilty enforcement for redux store
CSP Request Details
CSP Rejection Details
CSP Approved
Description
Environment
Potential Workaround
Checklist
hideTestRail: Results
Activity

Jason SkomorowskiDecember 9, 2016 at 9:50 PM
We decided to not use Immutable.js as we didn't want to require module developers to learn that API and so instead will be limited to Object.freeze() which we might just run in dev mode and turn off for production. See .

Jason SkomorowskiMarch 31, 2016 at 11:44 PMEdited
Notes from Rangle:
immutable-repl is a good tool for playing with immutable
probably shouldn't have to expose any immutable stuff to the stripes-modules, we can just Object.seal/Object.freeze the props we pass in

Jason SkomorowskiFebruary 4, 2016 at 5:12 AMEdited
seamless-immutable has some issues with redux-form or... something. At least, I found it suddenly choking when redux-crud employed it even in our small app and the only reducers were from redux-crud, redux-form and react-router-redux. Someone else hit it with form:
https://github.com/glittershark/reactable/issues/220
Went away when I configured redux-crud to use plain objects (after I first tried to initialise the redux store with an explicitly created empty seamless-immutable object). And I'm inclined to use redux-form. And it has ImmutableJS support.
Perhaps that is enough to make our decision on right there?
Details
Assignee
Jason SkomorowskiJason SkomorowskiReporter
Jason SkomorowskiJason SkomorowskiLabels
Priority
P4TestRail: Cases
Open TestRail: CasesTestRail: Runs
Open TestRail: Runs
Details
Details
Assignee

Reporter

Redux requires that reducers not mutate the state object in any way. Object.freeze() only works at the top level so there are a large variety of utilities to enable deeper protection. They can also offer some performance improvements based on their immutability guarantees.
The most commonly adopted implementation (and the one endorsed at the talk I went to last week) is ImmutableJS by Facebook. However, it doesn't actually guarantee immutability:
https://github.com/facebook/immutable-js/issues/546
And the syntax is... weird. Very many of the React related tools have special support for it. But perhaps not everything we may one day want to use. There are several alternatives, one that I'm leaning towards is seamless-immutable, they make a good case for it here:
http://tech.noredink.com/post/107617838018/switching-from-immutablejs-to-seamless-immutable
But it seems like that company is moving to use Elm for everything rather than Javascript so I wonder how well it will be maintained going forward? OTOH, not exactly an OS, fairly simple thing and has enough traction that it probably is okay?
https://github.com/rtfeldman/seamless-immutable
http://tech.noredink.com/post/136615783598/welcome-evan
At the moment I'm playing with it on the experiments repo as that's what the redux-crud package uses for its reducers. However it's very likely we'll reimplement that for OKAPI-specific crud anyway (OLE-89)