-
Robert Knight authored
The `annotationUI` module evolved from before we used Redux to manage app state and it was getting large and doing too much. This PR splits out most of the logic into smaller modules in the `reducers` folder. The `annotationUI` module continues to present the same exports as before to avoid needing to change too much in one commit. Each module in `reducers/` defines: - An `init` function which returns the initial state relating to some aspect of the application - A set of action types, relating to that aspect of the application - An `update` function which processes those actions - A set of action creators, which are helper functions that create these actions - A set of selector functions, which are helper functions that return derived data from this state There is a root module in reducers/index.js which combines the actions, init function and update functions from each module into a single init and update function which can be used to initialize the Redux store. Action creators which require access to the current app state or are asynchronous, such as `addAnnotations` return thunks. See https://github.com/gaearon/redux-thunk#motivation . Several selection-related action creators currently return thunks but can be refactored in future into plain actions. To avoid making this commit too large, annotationUI continues to export wrappers around the action creators so that code outside the Redux store and tests do not need to be changed.
ca72ca9a
Analyzing file…