(state: State, action: ReducerActionOf<RH>)
| 99 | const { reducer, createActions } = createReducer(initialState, reducers); |
| 100 | |
| 101 | const reducerWithMiddleware = (state: State, action: ReducerActionOf<RH>) => { |
| 102 | try { |
| 103 | const newState = reducer(state, action); |
| 104 | for (const mw of allMiddleware) { |
| 105 | try { |
| 106 | mw(state, newState, action); |
| 107 | } catch (error) { |
| 108 | Logger.error(`Error in middleware for action ${action.type}:`, error); |
| 109 | } |
| 110 | } |
| 111 | return newState; |
| 112 | } catch (error) { |
| 113 | Logger.error(`Error in reducer for action ${action.type}:`, error); |
| 114 | return state; |
| 115 | } |
| 116 | }; |
| 117 | |
| 118 | const valueAtom = atom(initialState()); |
| 119 | // map of SetAtom => Actions |
no test coverage detected
searching dependent graphs…