From fec41221a04dea4252e9f5dcfe4420aaacfaac5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20B=C3=BC=C3=9Femeyer?= Date: Tue, 12 Nov 2024 11:08:22 +0100 Subject: [PATCH 1/2] use forwardRef for scrollable virtualized tree --- .../scrollable_virtualized_tree.tsx | 16 ++++++++++++---- .../segments_tab/segments_view.tsx | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/frontend/javascripts/oxalis/view/right-border-tabs/scrollable_virtualized_tree.tsx b/frontend/javascripts/oxalis/view/right-border-tabs/scrollable_virtualized_tree.tsx index f2a8a8439f..aa02951bc0 100644 --- a/frontend/javascripts/oxalis/view/right-border-tabs/scrollable_virtualized_tree.tsx +++ b/frontend/javascripts/oxalis/view/right-border-tabs/scrollable_virtualized_tree.tsx @@ -1,7 +1,7 @@ import { Tree as AntdTree, type TreeProps } from "antd"; import type { BasicDataNode } from "antd/es/tree"; import { throttle } from "lodash"; -import { useCallback, useRef } from "react"; +import { forwardRef, useCallback, useRef } from "react"; import type RcTree from "rc-tree"; const MIN_SCROLL_SPEED = 30; @@ -10,8 +10,10 @@ const MIN_SCROLL_AREA_HEIGHT = 60; const SCROLL_AREA_RATIO = 10; // 1/10th of the container height const THROTTLE_TIME = 25; -function ScrollableVirtualizedTree( - props: TreeProps & { ref: React.RefObject }, +// React.forwardRef does not support generic types, so we need to define the type of the ref separately. +function ScrollableVirtualizedTreeInner( + props: TreeProps, + ref: React.Ref, ) { const wrapperRef = useRef(null); // biome-ignore lint/correctness/useExhaustiveDependencies: biome is not smart enough to notice that the function needs to be re-created when wrapperRef changes. @@ -56,9 +58,15 @@ function ScrollableVirtualizedTree( return (
- +
); } +const ScrollableVirtualizedTree = forwardRef(ScrollableVirtualizedTreeInner) as < + T extends BasicDataNode, +>( + props: TreeProps & { ref?: React.Ref }, +) => ReturnType; + export default ScrollableVirtualizedTree; diff --git a/frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segments_view.tsx b/frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segments_view.tsx index f37f3860e0..2188a8bd2c 100644 --- a/frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segments_view.tsx +++ b/frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segments_view.tsx @@ -1904,7 +1904,7 @@ class SegmentsView extends React.Component { overflow: "hidden", }} > - + Date: Tue, 12 Nov 2024 11:31:41 +0100 Subject: [PATCH 2/2] add changelog entry --- CHANGELOG.unreleased.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 2d0bec114f..9317f6f652 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -35,6 +35,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - Fix that scrolling in the trees and segments tab did not work while dragging. [#8162](https://github.com/scalableminds/webknossos/pull/8162) - Fixed that uploading a dataset which needs a conversion failed when the angstrom unit was configured for the conversion. [#8173](https://github.com/scalableminds/webknossos/pull/8173) - Fixed that the skeleton search did not automatically expand groups that contained the selected tree [#8129](https://github.com/scalableminds/webknossos/pull/8129) +- Fixed interactions in the trees and segments tab like the search due to a bug introduced by [#8162](https://github.com/scalableminds/webknossos/pull/8162). [#8186](https://github.com/scalableminds/webknossos/pull/8186) - Fixed a bug that zarr streaming version 3 returned the shape of mag (1, 1, 1) / the finest mag for all mags. [#8116](https://github.com/scalableminds/webknossos/pull/8116) - Fixed sorting of mags in outbound zarr streaming. [#8125](https://github.com/scalableminds/webknossos/pull/8125) - Fixed a bug where you could not create annotations for public datasets of other organizations. [#8107](https://github.com/scalableminds/webknossos/pull/8107)