From e1b2e2b6db640c2e9badf77adb9042acd0e2391c Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 25 Oct 2022 04:10:46 -0700 Subject: [PATCH 1/2] Fixed error: could not fetch task in a corner case --- cvat-ui/src/actions/projects-actions.ts | 2 +- cvat-ui/src/actions/tasks-actions.ts | 7 +++++-- cvat-ui/src/containers/task-page/task-page.tsx | 11 +---------- cvat-ui/src/reducers/tasks-reducer.ts | 5 ++++- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/cvat-ui/src/actions/projects-actions.ts b/cvat-ui/src/actions/projects-actions.ts index 51a90e71933c..eb01b017e9bf 100644 --- a/cvat-ui/src/actions/projects-actions.ts +++ b/cvat-ui/src/actions/projects-actions.ts @@ -70,7 +70,7 @@ export function getProjectTasksAsync(tasksQuery: Partial = {}): Thun getState().projects.gettingQuery, tasksQuery, )); - const query: TasksQuery = { + const query: Partial = { ...state.projects.tasksGettingQuery, ...tasksQuery, }; diff --git a/cvat-ui/src/actions/tasks-actions.ts b/cvat-ui/src/actions/tasks-actions.ts index 11c755c298c5..336e2924aa44 100644 --- a/cvat-ui/src/actions/tasks-actions.ts +++ b/cvat-ui/src/actions/tasks-actions.ts @@ -31,7 +31,7 @@ export enum TasksActionTypes { SWITCH_MOVE_TASK_MODAL_VISIBLE = 'SWITCH_MOVE_TASK_MODAL_VISIBLE', } -function getTasks(query: TasksQuery, updateQuery: boolean): AnyAction { +function getTasks(query: Partial, updateQuery: boolean): AnyAction { const action = { type: TasksActionTypes.GET_TASKS, payload: { @@ -65,7 +65,10 @@ function getTasksFailed(error: any): AnyAction { return action; } -export function getTasksAsync(query: TasksQuery, updateQuery = true): ThunkAction, {}, {}, AnyAction> { +export function getTasksAsync( + query: Partial, + updateQuery = true, +): ThunkAction, {}, {}, AnyAction> { return async (dispatch: ActionCreator): Promise => { dispatch(getTasks(query, updateQuery)); diff --git a/cvat-ui/src/containers/task-page/task-page.tsx b/cvat-ui/src/containers/task-page/task-page.tsx index 14a1b1ca70f6..ff5f37299c11 100644 --- a/cvat-ui/src/containers/task-page/task-page.tsx +++ b/cvat-ui/src/containers/task-page/task-page.tsx @@ -65,16 +65,7 @@ function mapDispatchToProps(dispatch: any, own: Props): DispatchToProps { return { getTask: (): void => { dispatch( - getTasksAsync({ - id, - page: 1, - search: null, - owner: null, - assignee: null, - name: null, - status: null, - mode: null, - }), + getTasksAsync({ id }), ); }, }; diff --git a/cvat-ui/src/reducers/tasks-reducer.ts b/cvat-ui/src/reducers/tasks-reducer.ts index ab39c697c351..9499ba263300 100644 --- a/cvat-ui/src/reducers/tasks-reducer.ts +++ b/cvat-ui/src/reducers/tasks-reducer.ts @@ -50,7 +50,10 @@ export default (state: TasksState = defaultState, action: AnyAction): TasksState fetching: true, hideEmpty: true, count: 0, - gettingQuery: action.payload.updateQuery ? { ...action.payload.query } : state.gettingQuery, + gettingQuery: action.payload.updateQuery ? { + ...defaultState.gettingQuery, + ...action.payload.query, + } : state.gettingQuery, }; case TasksActionTypes.GET_TASKS_SUCCESS: { const combinedWithPreviews = action.payload.array.map( From d107e5f572780dfb3df81e84dd9c447cff23895c Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 25 Oct 2022 04:14:09 -0700 Subject: [PATCH 2/2] Updated changelog --- CHANGELOG.md | 1 + cvat-ui/src/containers/task-page/task-page.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 081497f1e035..6bdd84af0f61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ non-ascii paths while adding files from "Connected file share" (issue #4428) - Fixed bug of computing Job's unsolved/resolved issues numbers () - Dataset export for job () - Angle is not propagated when use ``propagate`` feature () +- Could not fetch task in a corner case () - Restoring CVAT in case of React-renderning fail () - Deleted frames become restored if a user deletes frames from another job of the same task () diff --git a/cvat-ui/src/containers/task-page/task-page.tsx b/cvat-ui/src/containers/task-page/task-page.tsx index ff5f37299c11..4e342b4a06df 100644 --- a/cvat-ui/src/containers/task-page/task-page.tsx +++ b/cvat-ui/src/containers/task-page/task-page.tsx @@ -1,4 +1,5 @@ // Copyright (C) 2020-2022 Intel Corporation +// Copyright (C) 2022 CVAT.ai Corporation // // SPDX-License-Identifier: MIT