import undoable from 'redux-undo'

const todo = (state, action) => {
  switch (action.type) {
    case 'ADD_TODO':
      return {
        id: action.id,
        text: action.text,
        completed: false
      }
    case 'TOGGLE_TODO':
      if (state.id !== action.id) {
        return state
      }

      return {
        ...state,
        completed: !state.completed
      }
    default:
      return state
  }
}

const todos = (state = [], action) => {
  switch (action.type) {
    case 'ADD_TODO':
      return [
        ...state,
        todo(undefined, action)
      ]
    case 'TOGGLE_TODO':
      return state.map(t =>
        todo(t, action)
      )
    default:
      return state
  }
}

const undoableTodos = undoable(todos)

export default undoableTodos

@@ -8,16 +8,35 @@
 undoable
+, %7B includeAction %7D
  from 'r
@@ -749,16 +749,72 @@
 le(todos
+, %7B filter: includeAction(%5B'ADD_TODO', 'TOGGLE_TODO'%5D) %7D
 )%0A%0Aexpor

Fix example: todos-with-undo (#2788)