function reduce()

in packages/dag-history-component/src/state/reducers/pinnedState.ts [12:31]


function reduce(
	state: State = INITIAL_STATE,
	action: ReduxActions.Action<any>,
	config: Configuration<any>,
) {
	let result = state
	if (action.type === PIN_STATE) {
		const stateId = action.payload
		result = {
			...state,
			id: state.id === stateId ? undefined : stateId,
		}
	} else if (
		action.type.indexOf('DAG_HISTORY_') !== 0 &&
		config.actionFilter(action.type)
	) {
		result = INITIAL_STATE
	}
	return result
}