Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: LEAP-640: Don't save empty draft on View All #5417

Merged
merged 19 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/dist/libs/editor/main.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/libs/editor/main.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/libs/editor/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/libs/editor/main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/libs/editor/src/components/NewTaxonomy/NewTaxonomy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const NewTaxonomy = ({
}}
treeCheckStrictly
showCheckedStrategy={TreeSelect.SHOW_ALL}
treeExpandAction={false}
treeExpandAction="click"
dropdownMatchSelectWidth={dropdownWidth}
placeholder={options.placeholder || 'Click to add...'}
style={style}
Expand Down
1 change: 0 additions & 1 deletion web/libs/editor/src/components/TopBar/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const Actions = ({ store }) => {
const isViewAll = annotationStore.viewingAll;

const onToggleVisibility = useCallback(() => {
!isViewAll && entity.saveDraftImmediatelyWithResults({ useToast: true });
annotationStore.toggleViewingAllAnnotations();
}, [annotationStore]);

Expand Down
19 changes: 8 additions & 11 deletions web/libs/editor/src/components/TopBar/TopBar.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { observer } from 'mobx-react';

import { IconViewAll, LsPlus } from '../../assets/icons';
import { Button } from '../../common/Button/Button';
import { Tooltip } from '../../common/Tooltip/Tooltip';
import { Block, Elem } from '../../utils/bem';
import { FF_DEV_3873, isFF } from '../../utils/feature-flags';
import { AnnotationsCarousel } from '../AnnotationsCarousel/AnnotationsCarousel';
import { DynamicPreannotationsToggle } from '../AnnotationTab/DynamicPreannotationsToggle';
import { Actions } from './Actions';
import { Annotations } from './Annotations';
import { Controls } from './Controls';
import { CurrentTask } from './CurrentTask';
import { FF_DEV_3873, isFF } from '../../utils/feature-flags';
import { Button } from '../../common/Button/Button';
import { Tooltip } from '../../common/Tooltip/Tooltip';
import { IconViewAll, LsPlus } from '../../assets/icons';
import { AnnotationsCarousel } from '../AnnotationsCarousel/AnnotationsCarousel';

import './TopBar.styl';

export const TopBar = observer(({ store }) => {
Expand All @@ -19,11 +21,6 @@ export const TopBar = observer(({ store }) => {

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

const toggleViewAll = () => {
!isViewAll && entity.saveDraftImmediatelyWithResults({ useToast: true });
annotationStore.toggleViewingAllAnnotations();
};

return store ? (
<Block name="topbar" mod={{ newLabelingUI: isFF(FF_DEV_3873) }}>
{isFF(FF_DEV_3873) ? (
Expand All @@ -36,7 +33,7 @@ export const TopBar = observer(({ store }) => {
icon={<IconViewAll />}
type="text"
aria-label="View All"
onClick={toggleViewAll}
onClick={annotationStore.toggleViewingAllAnnotations}
primary={ isViewAll }
style={{
height: 36,
Expand Down
13 changes: 13 additions & 0 deletions web/libs/editor/src/stores/Annotation/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ const AnnotationStoreModel = types
function toggleViewingAll() {
if (self.viewingAllAnnotations || self.viewingAllPredictions) {
if (self.selected) {
// const comments = self.store.commentStore;

// @todo `currentComment` is an object and saving them was not a part of original fix
// @todo so I leave it for next fix coming soon
// if (comments.currentComment) {
// // comment will save draft automatically
// comments.commentFormSubmit();
// } else
if (self.selected.type === 'annotation') {
// save draft if there are changes waiting to be saved — it's handled inside
self.selected.saveDraftImmediately();
}

self.selected.unselectAll();
self.selected.selected = false;
}
Expand Down
Loading