Mindmap root node shows a "Delete Node" action that does nothing #214
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_whiteboard#214
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Mindmap root node shows a "Delete Node" action that does nothing
Summary
Right-clicking the root node of a mindmap shows a "Delete Node" item in the context menu, but selecting it does nothing — the root is silently protected. This is misleading: the action appears available but has no effect.
Confirmed behavior (current code)
In
crates/hero_whiteboard_admin/static/web/js/whiteboard/mindmap.js:showNodeContextMenualways appends aDelete Nodeitem that callsdeleteNode(group, nodeData), regardless of whether the node is the root.deleteNodeearly-returns for the root:if (nodeData === state.tree) return;— so on the root it is a no-op (no delete, no feedback).For comparison, keyboard delete is already consistent: in
shortcuts.js, Delete/Backspace on the active node callsWhiteboardMindmap.deleteActive, which refuses the root and falls through so the generic handler deletes the whole mindmap object.Desired behavior
Make the root's Delete meaningful and consistent with the keyboard path. Two acceptable options:
Recommended: option 2 — for the root, relabel the menu item to "Delete Mind Map" and delete the entire mindmap via
WhiteboardObjects.deleteObject(group.id())(the primitive used byWhiteboardTools.deleteSelected). This keeps the context menu and keyboard behavior consistent and removes the dead action. Non-root nodes keep "Delete Node".Files
crates/hero_whiteboard_admin/static/web/js/whiteboard/mindmap.js—showNodeContextMenu(conditional Delete item by root vs non-root), and possiblydeleteNode.Acceptance criteria
Notes
WhiteboardObjects.deleteObject(id)deletes a whole object by id and is exported;WhiteboardTools.deleteSelectedand the keyboard path already use it. Keep the locked-object guard already present indeleteNode/showNodeContextMenu.Fix implemented and verified
Change
crates/hero_whiteboard_admin/static/web/js/whiteboard/mindmap.jsshowNodeContextMenunow branches the delete item by node:deleteMindmap(group)helper mirrorsWhiteboardTools.deleteSelected: detaches the group from the transformer, hides the properties panel, then callsWhiteboardObjects.deleteObject(group.id())(which handles the undo snapshot, server sync, and connector cleanup).The previous misleading state — a "Delete Node" item on the root that silently did nothing (
deleteNodeearly-returns for the root) — is gone. The keyboard path is unchanged and already consistent (Delete on the active root deletes the whole mindmap).Verification
cargo test --workspace --lib-> ok, 0 failed (no regression; JS-only change).mindmap.json the running service contains bothDelete Mind Mapandfunction deleteMindmap(deployed via release build + restart).Manual check needed (no browser automation here)
Right-click the root -> menu shows "Delete Mind Map" and removes the whole mindmap. Right-click a child -> "Delete Node" removes just that node/subtree. Locked mindmaps remain protected.