dynamic-learning/next-client

Adding undo redo functionality for workbook

Closed this issue · 4 comments

Add undo-redo functionality for workbook
Workbook state is defined by the object

{
  slides,
  curSlide
}

Whenever a change happens for this object, it has to be pushed to undo stack.
Refer to this article in redux docs
https://redux.js.org/recipes/implementing-undo-history

There can be more items in the state. So basically out approach should be to store the undo and redo histories of an arbitrary state (Object).

Appropriate test cases are also needed.

Can we create a general reducer so that any object can be kept track of ?

Currently, the only place where a global store (instead of local states) is needed is the workbook screen. My thinking was that we can extend that to a global reducer if there arises a necessity for doing the same.

Okay I have added the undo and redo operations only for the workbook.

Resolved with #33