rbuchmeier / nordicNumbers

0 stars 0 forks source link

Changing the race does not sort results #42

Closed rbuchmeier closed 7 years ago

rbuchmeier commented 7 years ago

Selecting a new Race using the Selector Component does not call the sort_time reducer.

There are 2 primary ways to do this:

  1. Modify the change_race reducer to also encompass the sort_time reducer's algorithm. (Not so Clean)
  2. Dispatch a sort_time action when we dispatch a change_race reducer. (Cleaner)
rbuchmeier commented 7 years ago

The reason we don't want option 1 above is because it doesn't scale, and it makes a function do multiple things (in a way, side effects). Not ideal.

The reason we like option 2 (even though this means we have to remember to dispatch an additional action whenever we dispatch a change_race action) is because we can create a function that always dispatches both of those actions (along with any others we make in the future). (CLEANEST, not immediately necessary, but a good option to have in the future, whereas option 1 we had no alternative without undoing what was done).

rbuchmeier commented 7 years ago

46a556eff105b66a092bc426aff6f569c5863073 - Fixed (Dispatches sort_time action when race is retrieved from api.