X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/c53693847e622ef89ba7d62a93fc7d60dc68e6df..4ecec1c730f1a3fcfd5082cdc14250d39dac199c:/src/store/process-logs-panel/process-logs-panel-reducer.ts diff --git a/src/store/process-logs-panel/process-logs-panel-reducer.ts b/src/store/process-logs-panel/process-logs-panel-reducer.ts index 39a448b0..c7d694c0 100644 --- a/src/store/process-logs-panel/process-logs-panel-reducer.ts +++ b/src/store/process-logs-panel/process-logs-panel-reducer.ts @@ -3,7 +3,6 @@ // SPDX-License-Identifier: AGPL-3.0 import { ProcessLogsPanel } from './process-logs-panel'; -import { RootState } from '~/store/store'; import { ProcessLogsPanelAction, processLogsPanelActions } from './process-logs-panel-actions'; const initialState: ProcessLogsPanel = { @@ -14,6 +13,7 @@ const initialState: ProcessLogsPanel = { export const processLogsPanelReducer = (state = initialState, action: ProcessLogsPanelAction): ProcessLogsPanel => processLogsPanelActions.match(action, { + RESET_PROCESS_LOGS_PANEL: () => initialState, INIT_PROCESS_LOGS_PANEL: ({ filters, logs }) => ({ filters, logs, @@ -24,7 +24,8 @@ export const processLogsPanelReducer = (state = initialState, action: ProcessLog selectedFilter }), ADD_PROCESS_LOGS_PANEL_ITEM: ({ logType, log }) => { - const logsOfType = [...state.logs[logType], log]; + const currentLogs = state.logs[logType] || []; + const logsOfType = [...currentLogs, log]; const logs = { ...state.logs, [logType]: logsOfType }; return { ...state, logs }; },