Skip to content

Commit c30c97b

Browse files
authored
Fixed error: could not fetch task in a corner case (#5163)
* Fixed error: could not fetch task in a corner case * Updated changelog
1 parent 65a8bc1 commit c30c97b

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ non-ascii paths while adding files from "Connected file share" (issue #4428)
5151
- Fixed bug of computing Job's unsolved/resolved issues numbers (<https://github.com/opencv/cvat/pull/5101>)
5252
- Dataset export for job (<https://github.com/opencv/cvat/pull/5052>)
5353
- Angle is not propagated when use ``propagate`` feature (<https://github.com/opencv/cvat/pull/5139>)
54+
- Could not fetch task in a corner case (<https://github.com/opencv/cvat/pull/5163>)
5455
- Restoring CVAT in case of React-renderning fail (<https://github.com/opencv/cvat/pull/5134>)
5556
- Deleted frames become restored if a user deletes frames from another job of the same task
5657
(<https://github.com/opencv/cvat/pull/5138>)

cvat-ui/src/actions/projects-actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export function getProjectTasksAsync(tasksQuery: Partial<TasksQuery> = {}): Thun
7070
getState().projects.gettingQuery,
7171
tasksQuery,
7272
));
73-
const query: TasksQuery = {
73+
const query: Partial<TasksQuery> = {
7474
...state.projects.tasksGettingQuery,
7575
...tasksQuery,
7676
};

cvat-ui/src/actions/tasks-actions.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export enum TasksActionTypes {
3131
SWITCH_MOVE_TASK_MODAL_VISIBLE = 'SWITCH_MOVE_TASK_MODAL_VISIBLE',
3232
}
3333

34-
function getTasks(query: TasksQuery, updateQuery: boolean): AnyAction {
34+
function getTasks(query: Partial<TasksQuery>, updateQuery: boolean): AnyAction {
3535
const action = {
3636
type: TasksActionTypes.GET_TASKS,
3737
payload: {
@@ -65,7 +65,10 @@ function getTasksFailed(error: any): AnyAction {
6565
return action;
6666
}
6767

68-
export function getTasksAsync(query: TasksQuery, updateQuery = true): ThunkAction<Promise<void>, {}, {}, AnyAction> {
68+
export function getTasksAsync(
69+
query: Partial<TasksQuery>,
70+
updateQuery = true,
71+
): ThunkAction<Promise<void>, {}, {}, AnyAction> {
6972
return async (dispatch: ActionCreator<Dispatch>): Promise<void> => {
7073
dispatch(getTasks(query, updateQuery));
7174

cvat-ui/src/containers/task-page/task-page.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (C) 2020-2022 Intel Corporation
2+
// Copyright (C) 2022 CVAT.ai Corporation
23
//
34
// SPDX-License-Identifier: MIT
45

@@ -65,16 +66,7 @@ function mapDispatchToProps(dispatch: any, own: Props): DispatchToProps {
6566
return {
6667
getTask: (): void => {
6768
dispatch(
68-
getTasksAsync({
69-
id,
70-
page: 1,
71-
search: null,
72-
owner: null,
73-
assignee: null,
74-
name: null,
75-
status: null,
76-
mode: null,
77-
}),
69+
getTasksAsync({ id }),
7870
);
7971
},
8072
};

cvat-ui/src/reducers/tasks-reducer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ export default (state: TasksState = defaultState, action: AnyAction): TasksState
5050
fetching: true,
5151
hideEmpty: true,
5252
count: 0,
53-
gettingQuery: action.payload.updateQuery ? { ...action.payload.query } : state.gettingQuery,
53+
gettingQuery: action.payload.updateQuery ? {
54+
...defaultState.gettingQuery,
55+
...action.payload.query,
56+
} : state.gettingQuery,
5457
};
5558
case TasksActionTypes.GET_TASKS_SUCCESS: {
5659
const combinedWithPreviews = action.payload.array.map(

0 commit comments

Comments
 (0)