(reducer)
| 113 | } |
| 114 | |
| 115 | function recordHistory(reducer) { |
| 116 | return function (state, action) { |
| 117 | // Record initial state |
| 118 | const {type, payload} = action; |
| 119 | if (type === 'ON_PROP_CHANGE') { |
| 120 | // history records all prop changes that are inputs. |
| 121 | const historyEntry = getInputHistoryState(payload, state, true); |
| 122 | if (historyEntry && !isEmpty(historyEntry.props)) { |
| 123 | state.history.present = historyEntry; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | const nextState = reducer(state, action); |
| 128 | |
| 129 | if (type === 'ON_PROP_CHANGE' && payload.source !== 'response') { |
| 130 | /* |
| 131 | * if the prop change is an input, then |
| 132 | * record it so that it can be played back |
| 133 | */ |
| 134 | const historyEntry = getInputHistoryState(payload, nextState); |
| 135 | if (historyEntry && !isEmpty(historyEntry.props)) { |
| 136 | nextState.history = { |
| 137 | past: [...nextState.history.past, state.history.present], |
| 138 | present: historyEntry, |
| 139 | future: [] |
| 140 | }; |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | return nextState; |
| 145 | }; |
| 146 | } |
| 147 | |
| 148 | function reloaderReducer(reducer) { |
| 149 | return function (state, action) { |
no test coverage detected
searching dependent graphs…