in packages/dag-history-component/src/state/reducers/views.ts [24:59]
function reduce(
state: State,
action: ReduxActions.Action<any>,
config: ComponentConfiguration<any>,
) {
if (!state) {
state = {
...INITIAL_STATE,
...config.initialViewState,
}
}
let result = state
if (action.type === SELECT_MAIN_VIEW) {
result = {
...state,
mainView: action.payload,
}
} else if (action.type === SELECT_HISTORY_TYPE) {
result = {
...state,
historyType: action.payload,
}
} else if (action.type === TOGGLE_BRANCH_CONTAINER) {
result = {
...state,
branchContainerExpanded: !state.branchContainerExpanded,
}
} else if (!isHistoryAction(action) && config.actionFilter(action.type)) {
// Insertable actions clear the pinned state
result = {
...state,
mainView: ComponentView.HISTORY,
}
}
return result
}