nusmods icon indicating copy to clipboard operation
nusmods copied to clipboard

Undoing removing module is not properly persisted

Open ZhangYiJiang opened this issue 6 years ago • 1 comments

To reproduce:

  1. Remove a module from the timetable
  2. Undo the removal
  3. The module will show up again, as expected. Now refresh the browser
  4. The module will be gone

This is because of poor interaction between redux-persist, the library we're using to persist the Redux state, and our undo solution. Specifically, Redux Persist is operating on the sub-reducers, while the undo reducer is operating on the root state, so the undo is applied after the state has been persisted. https://github.com/nusmodifications/nusmods/blob/master/www/src/js/reducers/index.js#L68

The best way to fix this I think is to move the undo reducer to the sub-reducer, instead of it wrapping the root state. If you have another better solution I'm also happy to hear it.

This is a relatively major issue, so it would be good to get this fixed as soon as possible.

ZhangYiJiang avatar Oct 25 '18 12:10 ZhangYiJiang

@taneliang again

ZhangYiJiang avatar Sep 19 '19 18:09 ZhangYiJiang