Merge remote-tracking branch 'origin/main' into 19051-handle-quotes-in-search
[arvados-workbench2.git] / src / store / process-logs-panel / process-logs-panel-reducer.ts
index 38a3136437c1a6e12cad791cef21d662eb8c1f4c..c502f1b1ff47f18ee97873917e513f3c3daabc6e 100644 (file)
@@ -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 = {
@@ -25,10 +24,13 @@ export const processLogsPanelReducer = (state = initialState, action: ProcessLog
             selectedFilter
         }),
         ADD_PROCESS_LOGS_PANEL_ITEM: ({ logType, log }) => {
+            const filters = state.filters.indexOf(logType) > -1
+                ? state.filters
+                : [...state.filters, logType];
             const currentLogs = state.logs[logType] || [];
             const logsOfType = [...currentLogs, log];
             const logs = { ...state.logs, [logType]: logsOfType };
-            return { ...state, logs };
+            return { ...state, logs, filters };
         },
         default: () => state,
     });