From 899735d284abca8f674a8f3dd24b48e54b12601e Mon Sep 17 00:00:00 2001 From: zaha Date: Thu, 9 May 2024 13:19:32 +0300 Subject: [PATCH] Remove tasks by projectId from state after deleting project (#7854) --- cvat-ui/src/reducers/tasks-reducer.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cvat-ui/src/reducers/tasks-reducer.ts b/cvat-ui/src/reducers/tasks-reducer.ts index 8efcde10750..ce2e88258c0 100644 --- a/cvat-ui/src/reducers/tasks-reducer.ts +++ b/cvat-ui/src/reducers/tasks-reducer.ts @@ -8,6 +8,7 @@ import { BoundariesActionTypes } from 'actions/boundaries-actions'; import { TasksActionTypes } from 'actions/tasks-actions'; import { AuthActionTypes } from 'actions/auth-actions'; +import { ProjectsActionTypes } from 'actions/projects-actions'; import { TasksState } from '.'; const defaultState: TasksState = { @@ -77,6 +78,13 @@ export default (state: TasksState = defaultState, action: AnyAction): TasksState initialized: true, fetching: false, }; + case ProjectsActionTypes.DELETE_PROJECT_SUCCESS: { + const { projectId } = action.payload; + return { + ...state, + current: state.current.filter((_task) => _task.projectId !== projectId), + }; + } case TasksActionTypes.DELETE_TASK: { const { taskID } = action.payload; const { deletes } = state.activities;