Skip to content

Commit

Permalink
Fixed issue when save filtered object in AAM (#3401)
Browse files Browse the repository at this point in the history
* Fixed issue when save filtered object in AAM

* Updated version & changelog
  • Loading branch information
Boris Sekachev authored Jul 16, 2021
1 parent de2ce7e commit 719fcf3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
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

0 comments on commit 719fcf3

Please sign in to comment.