(reducer)
| 146 | } |
| 147 | |
| 148 | function reloaderReducer(reducer) { |
| 149 | return function (state, action) { |
| 150 | const {history, config, hooks} = state || {}; |
| 151 | let newState = state; |
| 152 | if (action.type === 'RELOAD') { |
| 153 | newState = {history, config, hooks}; |
| 154 | } else if (action.type === 'SET_CONFIG') { |
| 155 | // new config also reloads, and even clears history, |
| 156 | // in case there's a new user or even a totally different app! |
| 157 | // hooks are set at an even higher level than config though. |
| 158 | newState = {hooks}; |
| 159 | } |
| 160 | return reducer(newState, action); |
| 161 | }; |
| 162 | } |
| 163 | |
| 164 | export function createReducer() { |
| 165 | return reloaderReducer(recordHistory(mainReducer())); |
no outgoing calls
no test coverage detected
searching dependent graphs…