ng-summit-redux icon indicating copy to clipboard operation
ng-summit-redux copied to clipboard

Remove Immutable.js

Open wbuchwalter opened this issue 10 years ago • 2 comments

I'm creating an issue here to talk about that because the PR is getting quite hard to follow with all our comments.

Following on what you said about passing down a a mutable order list, why would this be an issue? It could cause an issue if you are mutating it, but this shouldn't happen.

  • If using reselect you will use {...orders} so no worries there
  • only other place I can think of where a mutation could happen is with a ng-repeat on orders (see this issue for how to avoid that: https://github.com/wbuchwalter/ng-redux/issues/23)

In production, I (sadly) enforce immutability by convention (because TypeScript), but so far it works well.

wbuchwalter avatar Sep 17 '15 01:09 wbuchwalter

Think I'm going to go ahead and do this. Think I might just change all of my reducers to be operating on an array, and break orders out into it's own reducer.

Each one becomes a pretty simple array of objects, each reducer gets more of a singular focus - and think it will clarify the code examples and slides more.

e-schultz avatar Sep 21 '15 17:09 e-schultz

Array in reducers is not a great idea when dealing with complex applications, hashmaps are usually better suited, but for a demo, arrays have the advantages of being less verbose -> more readbale reducers.

Maybe just add a sidenote somewhere explaining that.

Throwing some random related resources: https://github.com/gaearon/normalizr http://rackt.github.io/redux/docs/basics/Reducers.html (Note on Relationships) https://github.com/rackt/redux/issues/316

wbuchwalter avatar Sep 21 '15 18:09 wbuchwalter