diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 0607e9cfc80..553026791cd 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -23,6 +23,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released ### Fixed - Fixed that a disabled "Center new Nodes" option didn't work correctly in merger mode. [#5538](https://github.com/scalableminds/webknossos/pull/5538) - Fixed a bug where dataset uploads of zips with just one file inside failed. [#5534](https://github.com/scalableminds/webknossos/pull/5534) +- Fixed a benign error message when a dataset without a segmentation layer was opened in view mode or with a skeleton-only annotation. [#5583](https://github.com/scalableminds/webknossos/pull/5583) - Fixed crashing tree tab which could happen when dragging a node and then switching directly to another tab (e.g., comments) and then back again. [#5573](https://github.com/scalableminds/webknossos/pull/5573) - Fixed that the UI allowed mutating trees in the tree tab (dragging/creating/deleting trees and groups) in read-only tracings. [#5573](https://github.com/scalableminds/webknossos/pull/5573) - Fixed "Create a new tree group for this file" setting in front-end import when a group id of 0 was used in the NML. [#5573](https://github.com/scalableminds/webknossos/pull/5573) diff --git a/frontend/javascripts/oxalis/view/layouting/default_layout_configs.js b/frontend/javascripts/oxalis/view/layouting/default_layout_configs.js index 3d7703660fa..2dd9e86cfaa 100644 --- a/frontend/javascripts/oxalis/view/layouting/default_layout_configs.js +++ b/frontend/javascripts/oxalis/view/layouting/default_layout_configs.js @@ -8,6 +8,7 @@ // @flow import _ from "lodash"; +import type { ExtractReturn } from "libs/type_helpers"; import { getIsInIframe } from "libs/utils"; import { navbarHeight } from "navbar"; import Constants, { @@ -298,7 +299,6 @@ export const resetDefaultLayouts = () => { getDefaultLayouts.cache.clear(); }; -type ExtractReturn = $Call<(() => T) => T, Fn>; type Layout = $Keys>; export const getCurrentDefaultLayoutConfig = () => { diff --git a/frontend/javascripts/oxalis/view/node_context_menu.js b/frontend/javascripts/oxalis/view/node_context_menu.js index 57d73afc40b..b8d049385e6 100644 --- a/frontend/javascripts/oxalis/view/node_context_menu.js +++ b/frontend/javascripts/oxalis/view/node_context_menu.js @@ -200,9 +200,7 @@ function NoNodeContextMenuOptions({ }: NoNodeContextMenuProps) { useEffect(() => { (async () => { - if (segmentationLayer) { - await maybeFetchMeshFiles(segmentationLayer, dataset, false); - } + await maybeFetchMeshFiles(segmentationLayer, dataset, false); })(); }, []); diff --git a/frontend/javascripts/oxalis/view/right-menu/meshes_view.js b/frontend/javascripts/oxalis/view/right-menu/meshes_view.js index 1e807ff01e3..197d2c82231 100644 --- a/frontend/javascripts/oxalis/view/right-menu/meshes_view.js +++ b/frontend/javascripts/oxalis/view/right-menu/meshes_view.js @@ -59,7 +59,7 @@ export const stlIsosurfaceConstants = { // This file defines the component MeshesView. -const mapStateToProps = (state: OxalisState) => ({ +const mapStateToProps = (state: OxalisState): * => ({ meshes: state.tracing != null ? state.tracing.meshes : [], isImporting: state.uiInformation.isImportingMesh, isosurfaces: state.isosurfaces, @@ -75,7 +75,7 @@ const mapStateToProps = (state: OxalisState) => ({ currentMeshFile: state.currentMeshFile, }); -const mapDispatchToProps = (dispatch: Dispatch<*>) => ({ +const mapDispatchToProps = (dispatch: Dispatch<*>): * => ({ updateRemoteMeshMetadata(id: string, meshMetaData: $Shape) { dispatch(updateRemoteMeshMetaDataAction(id, meshMetaData)); }, @@ -121,8 +121,9 @@ const mapDispatchToProps = (dispatch: Dispatch<*>) => ({ }); type DispatchProps = ExtractReturn; +type StateProps = ExtractReturn; -type Props = {| ...DispatchProps |}; +type Props = {| ...DispatchProps, ...StateProps |}; type State = { hoveredListItem: ?number }; @@ -257,6 +258,9 @@ class MeshesView extends React.Component { Toast.info("No cell found at centered position"); return; } + if (!this.props.currentMeshFile || !this.props.segmentationLayer) { + return; + } await loadMeshFromFile( id, pos, @@ -295,12 +299,12 @@ class MeshesView extends React.Component { ); const getLoadPrecomputedMeshButton = () => { - const hasCurrenMeshFile = this.props.currentMeshFile; + const hasCurrentMeshFile = this.props.currentMeshFile; return ( { overlay={getMeshFilesDropdown()} buttonsRender={([leftButton, rightButton]) => [ React.cloneElement(leftButton, { - disabled: !hasCurrenMeshFile, + disabled: !hasCurrentMeshFile, style: { borderRightStyle: "dashed" }, }), React.cloneElement(rightButton, { style: { borderLeftStyle: "dashed" } }), diff --git a/frontend/javascripts/oxalis/view/right-menu/meshes_view_helper.js b/frontend/javascripts/oxalis/view/right-menu/meshes_view_helper.js index 02cebf064ad..8f0e74e73c6 100644 --- a/frontend/javascripts/oxalis/view/right-menu/meshes_view_helper.js +++ b/frontend/javascripts/oxalis/view/right-menu/meshes_view_helper.js @@ -24,10 +24,13 @@ import processTaskWithPool from "libs/task_pool"; const PARALLEL_MESH_LOADING_COUNT = 6; export async function maybeFetchMeshFiles( - segmentationLayer: APIDataLayer, + segmentationLayer: ?APIDataLayer, dataset: APIDataset, mustRequest: boolean, ): Promise { + if (!segmentationLayer) { + return; + } const files = Store.getState().availableMeshFiles; // only send new get request, if it hasn't happened before (files in store are null)