From 225a0d7de6bab1114b3a9af3dd9100aaab9bdff5 Mon Sep 17 00:00:00 2001 From: Philipp Otto Date: Tue, 7 Jun 2022 14:26:54 +0200 Subject: [PATCH 1/3] fix broken context menu in dataset-view-mode when no segmentation layer is visible --- frontend/javascripts/oxalis/view/context_menu.tsx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/frontend/javascripts/oxalis/view/context_menu.tsx b/frontend/javascripts/oxalis/view/context_menu.tsx index 7cc2cf70c11..1ded19278ec 100644 --- a/frontend/javascripts/oxalis/view/context_menu.tsx +++ b/frontend/javascripts/oxalis/view/context_menu.tsx @@ -350,11 +350,13 @@ function NodeContextMenuOptions({ volumeTracing, infoRows, allowUpdate, -}: NodeContextMenuOptionsProps) { +}: NodeContextMenuOptionsProps): JSX.Element { const dispatch = useDispatch(); if (skeletonTracing == null) { - return null; + throw new Error( + "NodeContextMenuOptions should not have been called without existing skeleton tracing.", + ); } const { userBoundingBoxes } = skeletonTracing; @@ -613,7 +615,7 @@ function getBoundingBoxMenuOptions({ ]; } -function NoNodeContextMenuOptions(props: NoNodeContextMenuProps) { +function NoNodeContextMenuOptions(props: NoNodeContextMenuProps): JSX.Element { const { skeletonTracing, volumeTracing, @@ -799,10 +801,6 @@ function NoNodeContextMenuOptions(props: NoNodeContextMenuProps) { allActions = nonSkeletonActions.concat(skeletonActions).concat(boundingBoxActions); } - if (allActions.length === 0) { - return null; - } - return ( Date: Tue, 7 Jun 2022 14:28:57 +0200 Subject: [PATCH 2/3] update changelog --- CHANGELOG.unreleased.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 5225af3bd76..30644536866 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -18,6 +18,7 @@ Added a warning for when the resolution in the XY viewport on z=1-downsampled da ### Fixed +- Fixed that the context menu broke webKnossos when opening it in dataset-view-mode while no segmentation layer was visible. [#6259](https://github.com/scalableminds/webknossos/pull/6259) ### Removed From 1ed23dc32da095204496ada6e07eb33eb34654d4 Mon Sep 17 00:00:00 2001 From: Philipp Otto Date: Tue, 7 Jun 2022 14:42:06 +0200 Subject: [PATCH 3/3] fix linting --- frontend/javascripts/oxalis/view/context_menu.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/javascripts/oxalis/view/context_menu.tsx b/frontend/javascripts/oxalis/view/context_menu.tsx index 1ded19278ec..0d6008e0c17 100644 --- a/frontend/javascripts/oxalis/view/context_menu.tsx +++ b/frontend/javascripts/oxalis/view/context_menu.tsx @@ -886,7 +886,6 @@ function ContextMenuInner(propsWithInputRef: PropsWithRef) { const { inputRef, ...props } = propsWithInputRef; const { skeletonTracing, - activeTool, maybeClickedNodeId, contextMenuPosition, hideContextMenu,