| 19 | } |
| 20 | |
| 21 | function deserialize( |
| 22 | state: LiftedState<S, A, MonitorState> |
| 23 | ): LiftedState<S, A, MonitorState> { |
| 24 | return { |
| 25 | ...state, |
| 26 | actionsById: mapValues(state.actionsById, (liftedAction) => ({ |
| 27 | ...liftedAction, |
| 28 | action: deserializeAction(liftedAction.action), |
| 29 | })), |
| 30 | committedState: deserializeState(state.committedState), |
| 31 | computedStates: state.computedStates.map((computedState) => ({ |
| 32 | ...computedState, |
| 33 | state: deserializeState(computedState.state), |
| 34 | })), |
| 35 | }; |
| 36 | } |
| 37 | |
| 38 | return (next) => |
| 39 | <S2, A2 extends Action<unknown>>( |