From 6c815c920c949a8518ac04069bc877b92943cee5 Mon Sep 17 00:00:00 2001 From: Brandon Martel Date: Mon, 18 Sep 2023 15:54:28 -0500 Subject: [PATCH 1/5] fix: OPTIC-109: Blank draft should not be created when an annotation is submitted --- src/components/BottomBar/Controls.js | 18 +++++++++++++++++- src/stores/Annotation/Annotation.js | 5 +++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/components/BottomBar/Controls.js b/src/components/BottomBar/Controls.js index 648c55bee..d0a90e08f 100644 --- a/src/components/BottomBar/Controls.js +++ b/src/components/BottomBar/Controls.js @@ -74,7 +74,6 @@ export const Controls = controlsInjector(observer(({ store, history, annotation if(store.hasInterface('comments:reject') ?? true) { buttonHandler(e, () => store.rejectAnnotation({}), 'Please enter a comment before rejecting'); } else { - console.log('rejecting'); await store.commentStore.commentFormSubmit(); store.rejectAnnotation({}); } @@ -146,6 +145,10 @@ export const Controls = controlsInjector(observer(({ store, history, annotation onClick={async (event) => { event.preventDefault(); + const selected = store.annotationStore?.selected; + + selected?.submissionInProgress(); + if ('URLSearchParams' in window) { const searchParams = new URLSearchParams(window.location.search); @@ -154,6 +157,7 @@ export const Controls = controlsInjector(observer(({ store, history, annotation window.history.pushState(null, '', newRelativePathQuery); } + await store.commentStore.commentFormSubmit(); onClickMethod(); }} @@ -179,6 +183,9 @@ export const Controls = controlsInjector(observer(({ store, history, annotation mod={{ has_icon: useExitOption, disabled: isDisabled }} onClick={async (event) => { if (event.target.classList.contains('lsf-dropdown__trigger')) return; + const selected = store.annotationStore?.selected; + + selected?.submissionInProgress(); await store.commentStore.commentFormSubmit(); store.submitAnnotation(); }} @@ -211,6 +218,9 @@ export const Controls = controlsInjector(observer(({ store, history, annotation mod={{ has_icon: useExitOption, disabled: isDisabled }} onClick={async (event) => { if (event.target.classList.contains('lsf-dropdown__trigger')) return; + const selected = store.annotationStore?.selected; + + selected?.submissionInProgress(); await store.commentStore.commentFormSubmit(); store.updateAnnotation(); }} @@ -241,6 +251,9 @@ export const Controls = controlsInjector(observer(({ store, history, annotation