Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

fix: OPTIC-218: 'Annotation saved successfully' message is NOT displayed when user exit label stream using 'Submit and exit' option #293

Merged
merged 6 commits into from
Feb 1, 2024
8 changes: 5 additions & 3 deletions src/sdk/lsf-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,14 @@ export class LSFWrapper {
// don't react on duplicated annotations error
{ errorHandler: result => result.status === 409 },
);
}, false, loadNext, exitStream);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only place passed this parameter in is this place, so please remove exiStream from submitCurrentAnnotation() as well.

}, false, loadNext);
const status = result?.$meta?.status;

if (status === 200 || status === 201) this.datamanager.invoke("toast", { message: "Annotation saved successfully", type: "info" });
else if (status !== undefined) this.datamanager.invoke("toast", { message: "There was an error saving your Annotation", type: "error" });

if (exitStream) return this.exitStream();

Comment on lines +594 to +596
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (exitStream) return this.exitStream();
if (exitStream) return this.exitStream();

};

/** @private */
Expand Down Expand Up @@ -854,7 +857,7 @@ export class LSFWrapper {
if (isFF(FF_OPTIC_2)) this.saveDraft();
this.loadTask(prevTaskId, prevAnnotationId, true);
}
async submitCurrentAnnotation(eventName, submit, includeId = false, loadNext = true, exitStream) {
async submitCurrentAnnotation(eventName, submit, includeId = false, loadNext = true) {
const { taskID, currentAnnotation } = this;
const unique_id = this.task.unique_lock_id;
const serializedAnnotation = this.prepareData(currentAnnotation, { includeId });
Expand Down Expand Up @@ -889,7 +892,6 @@ export class LSFWrapper {
}

this.setLoading(false);
if (exitStream) return this.exitStream();

if (!loadNext || this.datamanager.isExplorer) {
await this.loadTask(taskID, currentAnnotation.pk, true);
Expand Down
Loading