The basic idea is that once batch.start(), all the subsequent actions will return the same group value until meet batch.end(). Then redux-undo will automatically save them in one group, without inserting a new state in the past array.
Note that we create a unique id whenever we call batch.start(). In such case, if two batches are called back-to-back, they have different group values so that they will be stored in two states, rather than one state.
Then we can config the reducer like below:
An array of action types can be passed into init(), which keeps the ability of grouping by action types if they are not within the scope of start() and end().