diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index a0384b3cbc..16136b2e69 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -43,6 +43,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - Removed unnecessary scrollbars in skeleton tab that occurred especially after resizing. [#8148](https://github.com/scalableminds/webknossos/pull/8148) - Deleting a bounding box is now possible independently of a visible segmentation layer. [#8164](https://github.com/scalableminds/webknossos/pull/8164) - S3-compliant object storages can now be accessed via HTTPS. [#8167](https://github.com/scalableminds/webknossos/pull/8167) +- Fixed a layout persistence bug leading to empty viewports, triggered when switching between orthogonal, flight, or oblique mode. [#8177](https://github.com/scalableminds/webknossos/pull/8177) ### Removed diff --git a/frontend/javascripts/oxalis/view/layouting/flex_layout_wrapper.tsx b/frontend/javascripts/oxalis/view/layouting/flex_layout_wrapper.tsx index 6c79170cbc..59b34a3300 100644 --- a/frontend/javascripts/oxalis/view/layouting/flex_layout_wrapper.tsx +++ b/frontend/javascripts/oxalis/view/layouting/flex_layout_wrapper.tsx @@ -207,10 +207,7 @@ class FlexLayoutWrapper extends React.PureComponent { rebuildLayout() { const model = this.loadCurrentModel(); this.updateToModelStateAndAdjustIt(model); - this.setState({ - model, - }); - setTimeout(this.onLayoutChange, 1); + this.setState({ model }, () => this.onLayoutChange()); if (this.props.layoutName !== DEFAULT_LAYOUT_NAME) { sendAnalyticsEvent("load_custom_layout", { diff --git a/frontend/javascripts/oxalis/view/layouting/tracing_layout_view.tsx b/frontend/javascripts/oxalis/view/layouting/tracing_layout_view.tsx index a1671264ae..4a92943d24 100644 --- a/frontend/javascripts/oxalis/view/layouting/tracing_layout_view.tsx +++ b/frontend/javascripts/oxalis/view/layouting/tracing_layout_view.tsx @@ -194,14 +194,12 @@ class TracingLayoutView extends React.PureComponent { app.vent.emit("rerender"); if (model != null) { - this.setState({ - model, + this.setState({ model }, () => { + if (this.props.autoSaveLayouts) { + this.saveCurrentLayout(layoutName); + } }); } - - if (this.props.autoSaveLayouts) { - this.saveCurrentLayout(layoutName); - } }; debouncedOnLayoutChange = _.debounce(() => this.onLayoutChange(), Constants.RESIZE_THROTTLE_TIME);