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

[GSoC2024] fix cvat-ui error when open a job with issue (#7600) #7760

Closed
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixed

- UI error when job with issues is reopened from the job page
(<https://github.com/cvat-ai/cvat/pull/7760>)
11 changes: 10 additions & 1 deletion cvat-ui/src/actions/annotation-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export enum AnnotationActionTypes {
SAVE_ANNOTATIONS_FAILED = 'SAVE_ANNOTATIONS_FAILED',
SWITCH_PLAY = 'SWITCH_PLAY',
CONFIRM_CANVAS_READY = 'CONFIRM_CANVAS_READY',

UPDATE_CANVAS_READY = 'UPDATE_CANVAS_READY',
UPDATE_ACTIVE_CONTROL = 'UPDATE_ACTIVE_CONTROL',

COPY_SHAPE = 'COPY_SHAPE',
Expand Down Expand Up @@ -652,6 +652,15 @@ export function confirmCanvasReadyAsync(): ThunkAction {
};
}

export function updateCanvasReady(ready: boolean): AnyAction {
return {
type: AnnotationActionTypes.UPDATE_CANVAS_READY,
payload: {
ready,
},
};
}

export function changeFrameAsync(
toFrame: number,
fillBuffer?: boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
fetchAnnotationsAsync,
getDataFailed,
canvasErrorOccurred,
updateCanvasReady,
} from 'actions/annotation-actions';
import {
switchGrid,
Expand Down Expand Up @@ -144,6 +145,7 @@ interface DispatchToProps {
onGetDataFailed(error: Error): void;
onCanvasErrorOccurred(error: Error): void;
onStartIssue(position: number[]): void;
UpdateCanvasReadyStatus(status: boolean): void;
}

function mapStateToProps(state: CombinedState): StateToProps {
Expand Down Expand Up @@ -335,6 +337,9 @@ function mapDispatchToProps(dispatch: any): DispatchToProps {
onStartIssue(position: number[]): void {
dispatch(reviewActions.startIssue(position));
},
UpdateCanvasReadyStatus(status: boolean): void {
dispatch(updateCanvasReady(status));
},
};
}

Expand Down Expand Up @@ -565,6 +570,9 @@ class CanvasWrapperComponent extends React.PureComponent<Props> {
public componentWillUnmount(): void {
const { canvasInstance } = this.props as { canvasInstance: Canvas };

const { UpdateCanvasReadyStatus } = this.props;
UpdateCanvasReadyStatus(false);

canvasInstance.html().removeEventListener('mousedown', this.onCanvasMouseDown);
canvasInstance.html().removeEventListener('click', this.onCanvasClicked);
canvasInstance.html().removeEventListener('canvas.editstart', this.onCanvasEditStart);
Expand Down
9 changes: 9 additions & 0 deletions cvat-ui/src/reducers/annotation-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,15 @@ export default (state = defaultState, action: AnyAction): AnnotationState => {
},
};
}
case AnnotationActionTypes.UPDATE_CANVAS_READY: {
return {
...state,
canvas: {
...state.canvas,
ready: action.payload.ready,
},
};
}
case AnnotationActionTypes.REMEMBER_OBJECT: {
const { payload } = action;

Expand Down