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 issue when save filtered object in AAM #3401

Merged
merged 2 commits into from
Jul 16, 2021
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 @@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Calculate precise progress of decoding a video file (<https://github.com/openvinotoolkit/cvat/pull/3381>)
- Falsely successful `cvat_ui` image build in case of OOM error that leads to the default nginx welcome page
(<https://github.com/openvinotoolkit/cvat/pull/3379>)
- Fixed issue when save filtered object in AAM (<https://github.com/openvinotoolkit/cvat/pull/3401>)

### Security

Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cvat-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-ui",
"version": "1.20.6",
"version": "1.20.7",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
35 changes: 15 additions & 20 deletions cvat-ui/src/reducers/annotation-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ import {
Workspace,
} from './interfaces';

function updateActivatedStateID(newStates: any[], prevActivatedStateID: number | null): number | null {
return prevActivatedStateID === null || newStates.some((_state: any) => _state.clientID === prevActivatedStateID) ?
prevActivatedStateID :
null;
}

const defaultState: AnnotationState = {
activities: {
loads: {},
Expand Down Expand Up @@ -252,6 +258,7 @@ export default (state = defaultState, action: AnyAction): AnnotationState => {
};
}
case AnnotationActionTypes.CHANGE_FRAME_SUCCESS: {
const { activatedStateID } = state.annotations;
const {
number,
data,
Expand All @@ -265,12 +272,6 @@ export default (state = defaultState, action: AnyAction): AnnotationState => {
changeTime,
} = action.payload;

const activatedStateID = states
.map((_state: any) => _state.clientID)
.includes(state.annotations.activatedStateID) ?
state.annotations.activatedStateID :
null;

return {
...state,
player: {
Expand All @@ -291,7 +292,7 @@ export default (state = defaultState, action: AnyAction): AnnotationState => {
},
annotations: {
...state.annotations,
activatedStateID,
activatedStateID: updateActivatedStateID(states, activatedStateID),
states,
zLayer: {
min: minZ,
Expand Down Expand Up @@ -343,11 +344,14 @@ export default (state = defaultState, action: AnyAction): AnnotationState => {
}
case AnnotationActionTypes.SAVE_ANNOTATIONS_SUCCESS: {
const { states } = action.payload;
const { activatedStateID } = state.annotations;

return {
...state,
annotations: {
...state.annotations,
states,
activatedStateID: updateActivatedStateID(states, activatedStateID),
saving: {
...state.annotations.saving,
uploading: false,
Expand Down Expand Up @@ -964,21 +968,16 @@ export default (state = defaultState, action: AnyAction): AnnotationState => {
}
case AnnotationActionTypes.REDO_ACTION_SUCCESS:
case AnnotationActionTypes.UNDO_ACTION_SUCCESS: {
const { activatedStateID } = state.annotations;
const {
history, states, minZ, maxZ,
} = action.payload;

const activatedStateID = states
.map((_state: any) => _state.clientID)
.includes(state.annotations.activatedStateID) ?
state.annotations.activatedStateID :
null;

return {
...state,
annotations: {
...state.annotations,
activatedStateID,
activatedStateID: updateActivatedStateID(states, activatedStateID),
states,
history,
zLayer: {
Expand All @@ -990,18 +989,14 @@ export default (state = defaultState, action: AnyAction): AnnotationState => {
};
}
case AnnotationActionTypes.FETCH_ANNOTATIONS_SUCCESS: {
const { activatedStateID } = state.annotations;
const { states, minZ, maxZ } = action.payload;
const activatedStateID = states
.map((_state: any) => _state.clientID)
.includes(state.annotations.activatedStateID) ?
state.annotations.activatedStateID :
null;

return {
...state,
annotations: {
...state.annotations,
activatedStateID,
activatedStateID: updateActivatedStateID(states, activatedStateID),
states,
zLayer: {
min: minZ,
Expand Down