This huge PR complete the transition to Redux with the following parts :
Make the state fully immutable, and start to use Immutable.Record model for schema enforcement and to attach function to prototype (initially to remove these functions that dont use the state from getters)
Transform router_store, the core of the application into several reducers :
reducers/route handle the current url
reducers/modal handle the modal
reducers/message_fetch handle the state of fetching messages to fill the current view.
Following what was done in previous PR, transform all getters into pure getters, ie. function(state, args ...). These pure getters are placed in the puregetters until the transition is complete. Then renamed in https://github.com/aenario/cozy-emails/pull/7
Also transform ActionCreators in pure function(dispatch), this change is incomplete and need to be discussed cf difference between MessageActionCreator and RouterActionCreator
Following these two changes, we can use react-redux/connect to pass all data and actions as props from the container component. For now only components/application is a container component, we need to progressively switch all panel (message-list, conversation) to container as well.
The Router has been simplified and divided between the application specific code client/app/routes.coffee which contains routes and reverse routing and can be used from reducers & getters without introducing backbone router dependency and client/app/router.coffee which is the Backbone.Router with
Some linting were applied in specs.js files and all around
For review, please have a look at these somewhat more readable PRs : https://github.com/aenario/cozy-emails/pull/1 https://github.com/aenario/cozy-emails/pull/2 https://github.com/aenario/cozy-emails/pull/3 https://github.com/aenario/cozy-emails/pull/4 https://github.com/aenario/cozy-emails/pull/5 https://github.com/aenario/cozy-emails/pull/6
Not included here, will make a separate PR afterward https://github.com/aenario/cozy-emails/pull/7
What was done
This huge PR complete the transition to Redux with the following parts :
react-redux/connect
to pass all data and actions as props from the container component. For now onlycomponents/application
is a container component, we need to progressively switch all panel (message-list, conversation) to container as well.client/app/routes.coffee
which contains routes and reverse routing and can be used from reducers & getters without introducing backbone router dependency andclient/app/router.coffee
which is the Backbone.Router with"Golden rules" of the new structure
What to do
reselect
or alternative to memoize getters and increase performance WHEN NECESSARY