Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed error: could not fetch task in a corner case #5163

Merged
merged 2 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<https://github.com/opencv/cvat/pull/5101>)
- Dataset export for job (<https://github.com/opencv/cvat/pull/5052>)
- Angle is not propagated when use ``propagate`` feature (<https://github.com/opencv/cvat/pull/5139>)
- Could not fetch task in a corner case (<https://github.com/opencv/cvat/pull/5163>)
- Restoring CVAT in case of React-renderning fail (<https://github.com/opencv/cvat/pull/5134>)
- Deleted frames become restored if a user deletes frames from another job of the same task
(<https://github.com/opencv/cvat/pull/5138>)
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/actions/projects-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function getProjectTasksAsync(tasksQuery: Partial<TasksQuery> = {}): Thun
getState().projects.gettingQuery,
tasksQuery,
));
const query: TasksQuery = {
const query: Partial<TasksQuery> = {
...state.projects.tasksGettingQuery,
...tasksQuery,
};
Expand Down
7 changes: 5 additions & 2 deletions cvat-ui/src/actions/tasks-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TasksQuery>, updateQuery: boolean): AnyAction {
const action = {
type: TasksActionTypes.GET_TASKS,
payload: {
Expand Down Expand Up @@ -65,7 +65,10 @@ function getTasksFailed(error: any): AnyAction {
return action;
}

export function getTasksAsync(query: TasksQuery, updateQuery = true): ThunkAction<Promise<void>, {}, {}, AnyAction> {
export function getTasksAsync(
query: Partial<TasksQuery>,
updateQuery = true,
): ThunkAction<Promise<void>, {}, {}, AnyAction> {
return async (dispatch: ActionCreator<Dispatch>): Promise<void> => {
dispatch(getTasks(query, updateQuery));

Expand Down
12 changes: 2 additions & 10 deletions cvat-ui/src/containers/task-page/task-page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2022 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -65,16 +66,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 }),
);
},
};
Expand Down
5 changes: 4 additions & 1 deletion cvat-ui/src/reducers/tasks-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down