Skip to content

Commit

Permalink
Correct updating server ID after patching annotations (#7315)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev authored Jan 4, 2024
1 parent 39190c5 commit 64d6d7a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cvat-core/src/annotations-saver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export default class AnnotationsSaver {
const { created, updated, deleted } = this._split(exported);

onUpdate('Updated objects are being saved on the server');
this._extractClientIDs(updated);
const updatedIndexes = this._extractClientIDs(updated);
let requestBody = { ...updated, version: this.version };
let updatedData = null;
try {
Expand All @@ -373,6 +373,7 @@ export default class AnnotationsSaver {
}

this.version = updatedData.version;
this._updateCreatedObjects(updatedData, updatedIndexes);
for (const type of Object.keys(this.initialObjects)) {
for (const object of updatedData[type]) {
this.initialObjects[type][object.id] = object;
Expand All @@ -397,7 +398,7 @@ export default class AnnotationsSaver {
}

onUpdate('Created objects are being saved on the server');
const indexes = this._extractClientIDs(created);
const createdIndexes = this._extractClientIDs(created);
requestBody = { ...created, version: this.version };
let createdData = null;
try {
Expand All @@ -407,7 +408,7 @@ export default class AnnotationsSaver {
}

this.version = createdData.version;
this._updateCreatedObjects(createdData, indexes);
this._updateCreatedObjects(createdData, createdIndexes);
for (const type of Object.keys(this.initialObjects)) {
for (const object of createdData[type]) {
this.initialObjects[type][object.id] = object;
Expand Down

0 comments on commit 64d6d7a

Please sign in to comment.