Skip to content

Conversation

knollengewaechs
Copy link
Contributor

@knollengewaechs knollengewaechs commented Jul 28, 2025

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • From the bug report:
    create an annotation
    create a tree
    doubleclick the tree name
    try to select a part of the tree name with the mouse (does not work should now work 😉)
  • check that dragging & dropping works as before when not currently renaming a tree
  • check the same for tree groups :)

TODOs:

  • trees
  • tree groups

Issues:


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

  • Added changelog entry (create a $PR_NUMBER.md file in unreleased_changes or use ./tools/create-changelog-entry.py)
  • Added migration guide entry if applicable (edit the same file as for the changelog)
  • Updated documentation if applicable
  • Adapted wk-libs python client if relevant API parts change
  • Removed dev-only changes like prints and application.conf edits
  • Considered common edge cases
  • Needs datastore update after deployment

@knollengewaechs knollengewaechs self-assigned this Jul 28, 2025
Copy link
Contributor

coderabbitai bot commented Jul 28, 2025

📝 Walkthrough

Walkthrough

The changes update the tree and segment renaming logic in the frontend. They add a renaming counter to disable drag-and-drop while any node is being renamed, update function signatures to propagate renaming state, and clarify comments regarding draggable behavior. A changelog entry documents the improved text selection during renaming.

Changes

Cohort / File(s) Change Summary
Tree Node Drag and Rename Logic
frontend/javascripts/viewer/view/right-border-tabs/trees_tab/tree_hierarchy_view.tsx
Adds a renamingCounter state and helper functions to track renaming; disables dragging when renaming is active; passes new handlers to node renderers.
Node Renderer Function Signatures
frontend/javascripts/viewer/view/right-border-tabs/trees_tab/tree_hierarchy_renderers.tsx
Updates renderTreeNode and renderGroupNode to accept renaming state callbacks and forwards them to editable labels.
Segment Tab Draggable Comment
frontend/javascripts/viewer/view/right-border-tabs/segments_tab/segments_view.tsx
Corrects comment about when dragging is disabled during renaming.
Changelog
unreleased_changes/8801.md
Adds changelog entry describing improved renaming and text selection for skeletons and groups.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Assessment against linked issues

Objective Addressed Explanation
Allow mouse text selection during tree renaming; prevent drag interfering with renaming (#8701)

Suggested reviewers

  • philippotto

Poem

A rabbit hopped through code today,
Making sure trees let text select and play.
No more drag when names are new,
Renaming works just as it should do!
With counters set and comments neat,
This patch makes editing a treat.
🐇✨

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 4e083a9 and 1ec6aba.

📒 Files selected for processing (1)
  • frontend/javascripts/viewer/view/right-border-tabs/trees_tab/tree_hierarchy_view.tsx (3 hunks)
🚧 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
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch text-selection-renaming-tree

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 changed the title introduce state in tree component to prevent dragging during renaming Prevent dragging tree while renaming Jul 28, 2025
@knollengewaechs knollengewaechs marked this pull request as ready for review July 28, 2025 13:47
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.

Awesome 🎉

Thanks for fixing this. Please find one comment below. Feel free to disregard it as the way you implemented is already good and I am unsure whether a boolean is enough to keep track of whether elements are being renamed 👍

@knollengewaechs knollengewaechs enabled auto-merge (squash) July 29, 2025 12:17
@knollengewaechs knollengewaechs merged commit 8e7c2c0 into master Jul 29, 2025
5 checks passed
@knollengewaechs knollengewaechs deleted the text-selection-renaming-tree branch July 29, 2025 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text selection with mouse does not work while renaming a tree
2 participants