in packages/dag-history-component/src/state/reducers/bookmarkEdit.ts [19:41]
function reducer(
state: State = INITIAL_STATE,
action: ReduxActions.Action<any>,
config: Configuration<any>,
) {
if (action.type === BOOKMARK_EDIT) {
// Edit a bookmark
return { editIndex: action.payload }
} else if (
action.type === MOVE_BOOKMARK &&
action.payload.from === state.editIndex
) {
// If the user is moving the currently edited bookmark, update the editIndex
return { editIndex: action.payload.to }
} else if (
action.type === BOOKMARK_EDIT_DONE ||
(!isHistoryAction(action) && config.actionFilter(action.type))
) {
// Clear the edit state
return INITIAL_STATE
}
return state
}