Skip to content

Conversation

knollengewaechs
Copy link
Contributor

@knollengewaechs knollengewaechs commented Jun 13, 2025

Improve jumping between comments and skeletons by keeping skeleton tab up to date with active tree.

URL of deployed dev instance (used for testing):

Steps to test:

  • Open an annotation with multiple skeletons and add some comments.
  • Switch between comments and skeleton tab while activating different trees/nodes. Make sure both tabs are always in sync with the active tree, including expanding tabs and scrolling
  • Check the behaviour having both tabs open.
  • Within the skeleton tab, check the following cases
    • Upon opening the skeleton tab, the active tree should be scrolled to and the parent groups should be expanded
    • Click a node in the viewport and select "Focus Tree in Skeleton Tab" from the context menu. This should scroll to the selected tree and expand the parent groups
    • Change the active tree from the status bar (or somewhere else). Check that the skeleton tab is behaving accordingly (see above)

TODOs:

Issues:


(Please delete unneeded items, merge only when none are left open)

@knollengewaechs knollengewaechs self-assigned this Jun 13, 2025
Copy link
Contributor

coderabbitai bot commented Jun 13, 2025

📝 Walkthrough

Walkthrough

This change adds synchronization between the active tree selection and the skeleton tab UI by introducing lifecycle updates, centralized scroll logic, a Redux action for focusing trees, and an event bus with middleware and hooks to propagate and listen for Redux actions, enabling consistent UI updates and navigation between trees and comments.

Changes

Files/Paths Change Summary
frontend/javascripts/viewer/model/helpers/event_bus.ts Added a typed event bus using nanoevents for emitting and subscribing to Redux-like actions.
frontend/javascripts/viewer/model/helpers/event_emitter_middleware.ts Added Redux middleware to emit every dispatched action on the event bus.
frontend/javascripts/viewer/model/helpers/listener_helpers.ts Added useReduxActionListener React hook for subscribing to specific Redux actions via the event bus.
frontend/javascripts/viewer/model/actions/skeletontracing_actions.tsx Added focusTreeAction action creator, corresponding type alias, and updated union type to include it.
frontend/javascripts/viewer/store.ts Integrated eventEmitterMiddleware into the Redux middleware pipeline.
frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx Added componentDidUpdate lifecycle method to sync selectedTreeIds state with changes to activeTreeId prop.
frontend/javascripts/viewer/view/right-border-tabs/trees_tab/tree_hierarchy_view.tsx Refactored scroll-to-active-tree logic into a centralized function; added delayed scroll on mount; added Redux action listener for "FOCUS_TREE".
frontend/javascripts/viewer/view/context_menu.tsx Modified "Focus Tree in Skeleton Tab" context menu to dispatch focusTreeAction after expanding parent groups of the clicked tree.
unreleased_changes/8689.md Added changelog entry describing the skeleton tab synchronization fix for active tree selection and navigation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~40 minutes

Assessment against linked issues

Objective Addressed Explanation
Changing active tree should clear "selected tree ids" even when tree tab is invisible (#8628) componentDidUpdate in SkeletonTabView clears or updates selectedTreeIds on activeTreeId change.
When activating tree tab, it should scroll to active tree (#8628) TreeHierarchyView triggers scroll to active tree on initial render and on activeTreeId changes.
"Focus tree" should also work if the tree is already active (#8628) Added Redux action listener for "FOCUS_TREE" to trigger scroll regardless of active state.
"Focus tree" should also activate tree tab if it is not already visible (#8628) No code changes to activate or show the tree tab if it is hidden; this remains unaddressed.

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Addition of a generic event bus and middleware for emitting Redux actions (event_bus.ts, event_emitter_middleware.ts) These provide infrastructure for action-based events but are not explicitly required by the linked issue objectives.
Introduction of useReduxActionListener hook for subscribing to Redux actions This hook supports event bus usage but is not directly related to the issue objectives.

Possibly related PRs

Suggested labels

frontend

Suggested reviewers

  • philippotto
  • hotzenklotz

Poem

In the forest of tabs, a tree stands tall,
With actions and events, it answers the call.
Scroll and focus, selection anew,
Rabbits in code, hopping right through!
The skeleton dances, the comments align—
With every dispatch, the trees intertwine.
🐇🌳✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 670591e and 2e879e8.

📒 Files selected for processing (1)
  • frontend/javascripts/viewer/model/helpers/event_emitter_middleware.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/javascripts/viewer/model/helpers/event_emitter_middleware.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build-smoketest-push
  • GitHub Check: backend-tests
  • GitHub Check: frontend-tests
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch improve-jumping-between-trees-and-comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@knollengewaechs knollengewaechs marked this pull request as ready for review July 15, 2025 12:56
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c66d4e9 and bbd65f6.

📒 Files selected for processing (1)
  • frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx (1)
Learnt from: philippotto
PR: scalableminds/webknossos#8542
File: frontend/javascripts/viewer/model/sagas/volumetracing_saga.tsx:0-0
Timestamp: 2025-05-30T12:36:09.930Z
Learning: The WebKnossos frontend follows Redux immutability principles where reducers act immutably and create new state objects when changes occur. This makes reference equality checks (like `prevVolumeTracing.segments !== volumeTracing.segments`) reliable and efficient for detecting actual state changes, allowing memoization to work correctly.
🧬 Code Graph Analysis (1)
frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx (1)
frontend/javascripts/viewer/view/right-border-tabs/trees_tab/tree_hierarchy_renderers.tsx (1)
  • Props (60-73)
🔇 Additional comments (1)
frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx (1)

796-804: Good implementation of tree selection synchronization.

The componentDidUpdate method correctly implements the synchronization between the active tree and selected trees. The reference equality check is appropriate given WebKnossos's Redux immutability principles, and the null safety checks prevent potential runtime errors.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/javascripts/viewer/model/reducers/skeletontracing_reducer.ts (1)

561-561: Remove console.log statement before production deployment.

This appears to be debugging code that should not be committed to the main branch. If logging is needed for production, consider using a proper logging library instead of console.log.

-      console.log("Expanding parent groups of tree in reducer");
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a060431 and 1fdf5ff.

📒 Files selected for processing (6)
  • frontend/javascripts/viewer/model/helpers/event_bus.ts (1 hunks)
  • frontend/javascripts/viewer/model/helpers/event_emitter_middleware.ts (1 hunks)
  • frontend/javascripts/viewer/model/helpers/listener_helpers.ts (2 hunks)
  • frontend/javascripts/viewer/model/reducers/skeletontracing_reducer.ts (1 hunks)
  • frontend/javascripts/viewer/store.ts (2 hunks)
  • frontend/javascripts/viewer/view/right-border-tabs/trees_tab/tree_hierarchy_view.tsx (3 hunks)
🧠 Learnings (5)
📓 Common learnings
Learnt from: knollengewaechs
PR: scalableminds/webknossos#8689
File: frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx:796-804
Timestamp: 2025-07-15T13:15:37.856Z
Learning: In the WebKnossos codebase, the activeTreeId in skeleton tracing can become null when the active tree is deleted, during initialization, or when trees are deselected via deselectActiveTreeAction. The constructor of SkeletonTabView already handles this null case by setting selectedTreeIds to an empty array.
Learnt from: philippotto
PR: scalableminds/webknossos#8542
File: frontend/javascripts/viewer/model/sagas/volumetracing_saga.tsx:0-0
Timestamp: 2025-05-30T12:36:09.930Z
Learning: The WebKnossos frontend follows Redux immutability principles where reducers act immutably and create new state objects when changes occur. This makes reference equality checks (like `prevVolumeTracing.segments !== volumeTracing.segments`) reliable and efficient for detecting actual state changes, allowing memoization to work correctly.
Learnt from: knollengewaechs
PR: scalableminds/webknossos#8321
File: frontend/javascripts/components/slider.tsx:0-0
Timestamp: 2025-02-05T20:16:45.712Z
Learning: When tracking focus state that needs to be accessed by native event listeners (e.g., wheel events), use `useRef` instead of `useState` to ensure the event handlers always have access to the current value. This is because event listeners added via `addEventListener` would capture the initial state value if `useState` were used.
frontend/javascripts/viewer/model/reducers/skeletontracing_reducer.ts (4)

Learnt from: dieknolle3333
PR: #8168
File: frontend/javascripts/oxalis/model/reducers/skeletontracing_reducer_helpers.ts:125-125
Timestamp: 2024-11-22T17:17:39.914Z
Learning: In the createNode function within skeletontracing_reducer_helpers.ts, the property resolution is intentionally kept even when the parameter is renamed to mag.

Learnt from: knollengewaechs
PR: #8689
File: frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx:796-804
Timestamp: 2025-07-15T13:15:37.856Z
Learning: In the WebKnossos codebase, the activeTreeId in skeleton tracing can become null when the active tree is deleted, during initialization, or when trees are deselected via deselectActiveTreeAction. The constructor of SkeletonTabView already handles this null case by setting selectedTreeIds to an empty array.

Learnt from: philippotto
PR: #8542
File: frontend/javascripts/viewer/model/sagas/volumetracing_saga.tsx:0-0
Timestamp: 2025-05-30T12:36:09.930Z
Learning: The WebKnossos frontend follows Redux immutability principles where reducers act immutably and create new state objects when changes occur. This makes reference equality checks (like prevVolumeTracing.segments !== volumeTracing.segments) reliable and efficient for detecting actual state changes, allowing memoization to work correctly.

Learnt from: dieknolle3333
PR: #8168
File: frontend/javascripts/oxalis/model/sagas/proofread_saga.ts:1039-1039
Timestamp: 2024-11-22T17:18:04.217Z
Learning: In frontend/javascripts/oxalis/model/sagas/proofread_saga.ts, when calling getMagInfo, the use of volumeTracingLayer.resolutions is intentional and should not be changed to volumeTracingLayer.mags.

frontend/javascripts/viewer/store.ts (1)

Learnt from: philippotto
PR: #8542
File: frontend/javascripts/viewer/model/sagas/volumetracing_saga.tsx:0-0
Timestamp: 2025-05-30T12:36:09.930Z
Learning: The WebKnossos frontend follows Redux immutability principles where reducers act immutably and create new state objects when changes occur. This makes reference equality checks (like prevVolumeTracing.segments !== volumeTracing.segments) reliable and efficient for detecting actual state changes, allowing memoization to work correctly.

frontend/javascripts/viewer/model/helpers/event_emitter_middleware.ts (1)

Learnt from: philippotto
PR: #8542
File: frontend/javascripts/viewer/model/sagas/volumetracing_saga.tsx:0-0
Timestamp: 2025-05-30T12:36:09.930Z
Learning: The WebKnossos frontend follows Redux immutability principles where reducers act immutably and create new state objects when changes occur. This makes reference equality checks (like prevVolumeTracing.segments !== volumeTracing.segments) reliable and efficient for detecting actual state changes, allowing memoization to work correctly.

frontend/javascripts/viewer/model/helpers/listener_helpers.ts (2)

Learnt from: knollengewaechs
PR: #8321
File: frontend/javascripts/components/slider.tsx:0-0
Timestamp: 2025-02-05T20:16:45.712Z
Learning: When tracking focus state that needs to be accessed by native event listeners (e.g., wheel events), use useRef instead of useState to ensure the event handlers always have access to the current value. This is because event listeners added via addEventListener would capture the initial state value if useState were used.

Learnt from: philippotto
PR: #8542
File: frontend/javascripts/viewer/model/sagas/volumetracing_saga.tsx:0-0
Timestamp: 2025-05-30T12:36:09.930Z
Learning: The WebKnossos frontend follows Redux immutability principles where reducers act immutably and create new state objects when changes occur. This makes reference equality checks (like prevVolumeTracing.segments !== volumeTracing.segments) reliable and efficient for detecting actual state changes, allowing memoization to work correctly.

✅ Files skipped from review due to trivial changes (1)
  • frontend/javascripts/viewer/model/helpers/event_bus.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/javascripts/viewer/view/right-border-tabs/trees_tab/tree_hierarchy_view.tsx
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: knollengewaechs
PR: scalableminds/webknossos#8689
File: frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx:796-804
Timestamp: 2025-07-15T13:15:37.856Z
Learning: In the WebKnossos codebase, the activeTreeId in skeleton tracing can become null when the active tree is deleted, during initialization, or when trees are deselected via deselectActiveTreeAction. The constructor of SkeletonTabView already handles this null case by setting selectedTreeIds to an empty array.
Learnt from: philippotto
PR: scalableminds/webknossos#8542
File: frontend/javascripts/viewer/model/sagas/volumetracing_saga.tsx:0-0
Timestamp: 2025-05-30T12:36:09.930Z
Learning: The WebKnossos frontend follows Redux immutability principles where reducers act immutably and create new state objects when changes occur. This makes reference equality checks (like `prevVolumeTracing.segments !== volumeTracing.segments`) reliable and efficient for detecting actual state changes, allowing memoization to work correctly.
Learnt from: knollengewaechs
PR: scalableminds/webknossos#8321
File: frontend/javascripts/components/slider.tsx:0-0
Timestamp: 2025-02-05T20:16:45.712Z
Learning: When tracking focus state that needs to be accessed by native event listeners (e.g., wheel events), use `useRef` instead of `useState` to ensure the event handlers always have access to the current value. This is because event listeners added via `addEventListener` would capture the initial state value if `useState` were used.
frontend/javascripts/viewer/model/reducers/skeletontracing_reducer.ts (4)

Learnt from: dieknolle3333
PR: #8168
File: frontend/javascripts/oxalis/model/reducers/skeletontracing_reducer_helpers.ts:125-125
Timestamp: 2024-11-22T17:17:39.914Z
Learning: In the createNode function within skeletontracing_reducer_helpers.ts, the property resolution is intentionally kept even when the parameter is renamed to mag.

Learnt from: knollengewaechs
PR: #8689
File: frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx:796-804
Timestamp: 2025-07-15T13:15:37.856Z
Learning: In the WebKnossos codebase, the activeTreeId in skeleton tracing can become null when the active tree is deleted, during initialization, or when trees are deselected via deselectActiveTreeAction. The constructor of SkeletonTabView already handles this null case by setting selectedTreeIds to an empty array.

Learnt from: philippotto
PR: #8542
File: frontend/javascripts/viewer/model/sagas/volumetracing_saga.tsx:0-0
Timestamp: 2025-05-30T12:36:09.930Z
Learning: The WebKnossos frontend follows Redux immutability principles where reducers act immutably and create new state objects when changes occur. This makes reference equality checks (like prevVolumeTracing.segments !== volumeTracing.segments) reliable and efficient for detecting actual state changes, allowing memoization to work correctly.

Learnt from: dieknolle3333
PR: #8168
File: frontend/javascripts/oxalis/model/sagas/proofread_saga.ts:1039-1039
Timestamp: 2024-11-22T17:18:04.217Z
Learning: In frontend/javascripts/oxalis/model/sagas/proofread_saga.ts, when calling getMagInfo, the use of volumeTracingLayer.resolutions is intentional and should not be changed to volumeTracingLayer.mags.

frontend/javascripts/viewer/store.ts (1)

Learnt from: philippotto
PR: #8542
File: frontend/javascripts/viewer/model/sagas/volumetracing_saga.tsx:0-0
Timestamp: 2025-05-30T12:36:09.930Z
Learning: The WebKnossos frontend follows Redux immutability principles where reducers act immutably and create new state objects when changes occur. This makes reference equality checks (like prevVolumeTracing.segments !== volumeTracing.segments) reliable and efficient for detecting actual state changes, allowing memoization to work correctly.

frontend/javascripts/viewer/model/helpers/event_emitter_middleware.ts (1)

Learnt from: philippotto
PR: #8542
File: frontend/javascripts/viewer/model/sagas/volumetracing_saga.tsx:0-0
Timestamp: 2025-05-30T12:36:09.930Z
Learning: The WebKnossos frontend follows Redux immutability principles where reducers act immutably and create new state objects when changes occur. This makes reference equality checks (like prevVolumeTracing.segments !== volumeTracing.segments) reliable and efficient for detecting actual state changes, allowing memoization to work correctly.

frontend/javascripts/viewer/model/helpers/listener_helpers.ts (2)

Learnt from: knollengewaechs
PR: #8321
File: frontend/javascripts/components/slider.tsx:0-0
Timestamp: 2025-02-05T20:16:45.712Z
Learning: When tracking focus state that needs to be accessed by native event listeners (e.g., wheel events), use useRef instead of useState to ensure the event handlers always have access to the current value. This is because event listeners added via addEventListener would capture the initial state value if useState were used.

Learnt from: philippotto
PR: #8542
File: frontend/javascripts/viewer/model/sagas/volumetracing_saga.tsx:0-0
Timestamp: 2025-05-30T12:36:09.930Z
Learning: The WebKnossos frontend follows Redux immutability principles where reducers act immutably and create new state objects when changes occur. This makes reference equality checks (like prevVolumeTracing.segments !== volumeTracing.segments) reliable and efficient for detecting actual state changes, allowing memoization to work correctly.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: backend-tests
  • GitHub Check: frontend-tests
  • GitHub Check: build-smoketest-push
🔇 Additional comments (2)
frontend/javascripts/viewer/store.ts (1)

81-81: Good middleware placement and integration.

The eventEmitterMiddleware is correctly placed at the end of the middleware chain, ensuring all other middleware processes actions before events are emitted to listeners. This prevents potential race conditions or ordering issues.

Also applies to: 614-619

frontend/javascripts/viewer/model/helpers/event_emitter_middleware.ts (1)

4-7: Clean and correct Redux middleware implementation.

The middleware properly follows Redux middleware patterns, emits events for all actions, and maintains the middleware chain. The implementation is minimal and focused on its single responsibility.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
frontend/javascripts/viewer/model/actions/skeletontracing_actions.tsx (1)

406-411: Refactor to match established coding pattern.

The implementation is functionally correct but inconsistent with the coding style used throughout the file. All other action creators use arrow functions with implicit returns.

Apply this diff to match the established pattern:

-export const focusTreeAction = (tree: Tree) => {
-  return {
-    type: "FOCUS_TREE",
-    tree,
-  } as const;
-};
+export const focusTreeAction = (tree: Tree) =>
+  ({
+    type: "FOCUS_TREE",
+    tree,
+  }) as const;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1fdf5ff and 4ea6808.

📒 Files selected for processing (3)
  • frontend/javascripts/viewer/model/actions/skeletontracing_actions.tsx (3 hunks)
  • frontend/javascripts/viewer/view/context_menu.tsx (2 hunks)
  • frontend/javascripts/viewer/view/right-border-tabs/trees_tab/tree_hierarchy_view.tsx (3 hunks)
🧠 Learnings (3)
📓 Common learnings
Learnt from: knollengewaechs
PR: scalableminds/webknossos#8689
File: frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx:796-804
Timestamp: 2025-07-15T13:15:37.856Z
Learning: In the WebKnossos codebase, the activeTreeId in skeleton tracing can become null when the active tree is deleted, during initialization, or when trees are deselected via deselectActiveTreeAction. The constructor of SkeletonTabView already handles this null case by setting selectedTreeIds to an empty array.
Learnt from: philippotto
PR: scalableminds/webknossos#8542
File: frontend/javascripts/viewer/model/sagas/volumetracing_saga.tsx:0-0
Timestamp: 2025-05-30T12:36:09.930Z
Learning: The WebKnossos frontend follows Redux immutability principles where reducers act immutably and create new state objects when changes occur. This makes reference equality checks (like `prevVolumeTracing.segments !== volumeTracing.segments`) reliable and efficient for detecting actual state changes, allowing memoization to work correctly.
frontend/javascripts/viewer/view/context_menu.tsx (1)

Learnt from: knollengewaechs
PR: #8689
File: frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx:796-804
Timestamp: 2025-07-15T13:15:37.856Z
Learning: In the WebKnossos codebase, the activeTreeId in skeleton tracing can become null when the active tree is deleted, during initialization, or when trees are deselected via deselectActiveTreeAction. The constructor of SkeletonTabView already handles this null case by setting selectedTreeIds to an empty array.

frontend/javascripts/viewer/model/actions/skeletontracing_actions.tsx (1)

Learnt from: knollengewaechs
PR: #8689
File: frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx:796-804
Timestamp: 2025-07-15T13:15:37.856Z
Learning: In the WebKnossos codebase, the activeTreeId in skeleton tracing can become null when the active tree is deleted, during initialization, or when trees are deselected via deselectActiveTreeAction. The constructor of SkeletonTabView already handles this null case by setting selectedTreeIds to an empty array.

🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/javascripts/viewer/view/right-border-tabs/trees_tab/tree_hierarchy_view.tsx
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: knollengewaechs
PR: scalableminds/webknossos#8689
File: frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx:796-804
Timestamp: 2025-07-15T13:15:37.856Z
Learning: In the WebKnossos codebase, the activeTreeId in skeleton tracing can become null when the active tree is deleted, during initialization, or when trees are deselected via deselectActiveTreeAction. The constructor of SkeletonTabView already handles this null case by setting selectedTreeIds to an empty array.
Learnt from: philippotto
PR: scalableminds/webknossos#8542
File: frontend/javascripts/viewer/model/sagas/volumetracing_saga.tsx:0-0
Timestamp: 2025-05-30T12:36:09.930Z
Learning: The WebKnossos frontend follows Redux immutability principles where reducers act immutably and create new state objects when changes occur. This makes reference equality checks (like `prevVolumeTracing.segments !== volumeTracing.segments`) reliable and efficient for detecting actual state changes, allowing memoization to work correctly.
frontend/javascripts/viewer/view/context_menu.tsx (1)

Learnt from: knollengewaechs
PR: #8689
File: frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx:796-804
Timestamp: 2025-07-15T13:15:37.856Z
Learning: In the WebKnossos codebase, the activeTreeId in skeleton tracing can become null when the active tree is deleted, during initialization, or when trees are deselected via deselectActiveTreeAction. The constructor of SkeletonTabView already handles this null case by setting selectedTreeIds to an empty array.

frontend/javascripts/viewer/model/actions/skeletontracing_actions.tsx (1)

Learnt from: knollengewaechs
PR: #8689
File: frontend/javascripts/viewer/view/right-border-tabs/trees_tab/skeleton_tab_view.tsx:796-804
Timestamp: 2025-07-15T13:15:37.856Z
Learning: In the WebKnossos codebase, the activeTreeId in skeleton tracing can become null when the active tree is deleted, during initialization, or when trees are deselected via deselectActiveTreeAction. The constructor of SkeletonTabView already handles this null case by setting selectedTreeIds to an empty array.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: backend-tests
  • GitHub Check: build-smoketest-push
🔇 Additional comments (4)
frontend/javascripts/viewer/model/actions/skeletontracing_actions.tsx (2)

30-30: LGTM!

The type alias follows the established pattern and is positioned appropriately.


123-123: LGTM!

The union type update is correct and the action type is appropriately excluded from SkeletonTracingSaveRelevantActions since it's a UI-only action.

frontend/javascripts/viewer/view/context_menu.tsx (2)

113-113: LGTM!

The import is correctly placed and follows the established pattern.


628-628: LGTM!

The dispatch call is logically placed after expanding parent groups, ensuring proper sequence of operations for the "Focus Tree in Skeleton Tab" functionality.

@knollengewaechs knollengewaechs changed the title Keep skeleton tab up to date with active tree Improve jumping between comments and skeletons Jul 28, 2025
@knollengewaechs knollengewaechs requested review from MichaelBuessemeyer and removed request for philippotto July 28, 2025 11:33
@coderabbitai coderabbitai bot mentioned this pull request Jul 28, 2025
9 tasks
Copy link
Contributor

@MichaelBuessemeyer MichaelBuessemeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks for making this possible.

I only found one potential improvement by maybe adding better typing to the new middleware you added. Besides this, everything looks very nice and testing worked as well 🚀

@knollengewaechs
Copy link
Contributor Author

Thanks for the quick review! 🙏 Will merge this when everyone is back at their desk :)

@knollengewaechs knollengewaechs merged commit c570ed8 into master Jul 29, 2025
5 checks passed
@knollengewaechs knollengewaechs deleted the improve-jumping-between-trees-and-comments branch July 29, 2025 11:49
@coderabbitai coderabbitai bot mentioned this pull request Sep 5, 2025
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants