From 7cade43a08635fd9d8db74bcebfbb9b6456e94c1 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Fri, 25 Dec 2020 20:31:37 +0100 Subject: [PATCH] Bugfix --- src/editor/Editor.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/editor/Editor.jsx b/src/editor/Editor.jsx index b6383bc..8e2faea 100644 --- a/src/editor/Editor.jsx +++ b/src/editor/Editor.jsx @@ -41,8 +41,11 @@ const Editor = props => { // on move. Therefore, don't update if a) props.annotation equals // the currentAnnotation, or props.annotation and currentAnnotations are // a selection, just created by the user. - const preventUpdate = currentAnnotation?.isSelection ? - annotation?.isSelection : currentAnnotation?.id === annotation.id; + const preventUpdate = + currentAnnotation && ( // Always update if there is no current annotation + (currentAnnotation.isSelection && annotation.isSelection) || // Don't update selection + (currentAnnotation.id === annotation.id) // Don't update if annotation ID is the same + ) if (!preventUpdate) setCurrentAnnotation(annotation);