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

Commit

Permalink
fix: optic-113: draft save on switch history
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis1282 committed Oct 19, 2023
1 parent 657e611 commit 2a051b8
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/components/CurrentEntity/AnnotationHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { Userpic } from '../../common/Userpic/Userpic';
import { Block, Elem } from '../../utils/bem';
import { humanDateDiff, userDisplayName } from '../../utils/utilities';
import './AnnotationHistory.styl';
import { when } from 'mobx';

type HistoryItemType = (
'prediction' |
Expand Down Expand Up @@ -137,13 +136,9 @@ const AnnotationHistoryComponent: FC<any> = ({
annotationStore.selectHistory(isSelected ? null : item);
return;
}


if (hasChanges) {
annotation.saveDraftImmediately();
// wait for draft to be saved before switching to history
await when(() => !annotation.isDraftSaving);
}

// wait for draft to be saved before switching to history
if (hasChanges) await annotation.saveDraftImmediatelyWithResults();

if (isLastItem || isSelected) {
// last history state and draft are actual annotation, not from history
Expand Down

0 comments on commit 2a051b8

Please sign in to comment.