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

feat: OPTIC-107: Draft saving on view all #1637

Merged
merged 11 commits into from
Jan 8, 2024
8 changes: 7 additions & 1 deletion src/components/TopBar/TopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ export const TopBar = observer(({ store }) => {

const isViewAll = annotationStore?.viewingAll === true;

const toggleViewAll = async () => {
!isViewAll && await store.submitDraft(annotationStore.selected, { useToast: true });
annotationStore.toggleViewingAllAnnotations();
};


return store ? (
<Block name="topbar" mod={{ newLabelingUI: isFF(FF_DEV_3873) }}>
{isFF(FF_DEV_3873) ? (
Expand All @@ -31,7 +37,7 @@ export const TopBar = observer(({ store }) => {
icon={<IconViewAll />}
type="text"
aria-label="View All"
onClick={() => annotationStore.toggleViewingAllAnnotations()}
onClick={toggleViewAll}
primary={ isViewAll }
style={{
height: 36,
Expand Down
3 changes: 2 additions & 1 deletion src/core/TimeTraveller.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const TimeTraveller = types
undoIdx: 0,
targetPath: '',
skipNextUndoState: types.optional(types.boolean, false),

lastAdditionTime: types.optional(types.Date, () => new Date()),
createdIdx: 0,
})
.volatile(() => ({
Expand Down Expand Up @@ -77,6 +77,7 @@ const TimeTraveller = types
},

onUpdate(handler) {
this.lastAdditionTime = new Date();
Travis1282 marked this conversation as resolved.
Show resolved Hide resolved
updateHandlers.add(handler);
return () => {
updateHandlers.delete(handler);
Expand Down
Loading