Scan-o-Matic / scanomatic

Scanomatic
GNU General Public License v3.0
10 stars 4 forks source link

Redux store for projects page #356

Closed gdetrez closed 6 years ago

gdetrez commented 6 years ago

Add action creators, reducers and selectors to manage the state of the projects page. Right now, there's no communication with the server: the state only exists in redux and doesn't survive a page reload.

In addition to the standard actions, this also adds a "thunk". Thunks are delayed actions that have the possibilities of doing side effects or dispatch multiple actions. Here the submitNewProject action is a thunk that checks the form values and dispatches action to mark the form as submitted, add project and close the form.

Action, reducers and selectors are also statically typechecked with flow. Most notably, because actions and reducers are typechecked, we don't have to import/export a gazillion of action type constants but still get the guarantee that there are no typos/discrepancies between the action types in actions.js and the reducers. (We actually get even better guarantees!) This is a bit of an experiment but so far I mostly like it.

codecov-io commented 6 years ago

Codecov Report

Merging #356 into master will increase coverage by 0.5%. The diff coverage is 94.77%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #356     +/-   ##
=========================================
+ Coverage    39.5%   40.01%   +0.5%     
=========================================
  Files         185      192      +7     
  Lines       16482    16635    +153     
  Branches     2894     2894             
=========================================
+ Hits         6512     6656    +144     
- Misses       9562     9570      +8     
- Partials      408      409      +1
Impacted Files Coverage Δ
...omatic/ui_server_data/js/src/projects/selectors.js 100% <100%> (ø)
...data/js/src/projects/reducers/entities/projects.js 100% <100%> (ø)
..._data/js/src/projects/reducers/forms/newProject.js 100% <100%> (ø)
...a/js/src/projects/reducers/entities/experiments.js 100% <100%> (ø)
...anomatic/ui_server_data/js/src/projects/actions.js 80.76% <80.76%> (ø)
...ta/js/src/projects/reducers/forms/newExperiment.js 90.9% <90.9%> (ø)
...tic/ui_server_data/js/src/projects/StateBuilder.js 97.01% <97.01%> (ø)
scanomatic/data_processing/phases/segmentation.py 73.81% <0%> (-0.28%) :arrow_down:
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b57a5c2...4c39ebf. Read the comment docs.