Skip to content

Removing a node from a Multinode Treepicker removes the wrong node in a certain context #20943

@g-rahman

Description

@g-rahman

Which Umbraco version are you using?

13.11.0

Bug summary

When a multinode treepicker contains references to one or more nodes that no longer exist, any attempt to remove nodes that are low on the picker's list (below the deleted node) cause the wrong node to be removed from the list.

Specifics

When a multinode treepicker contains references to one or more nodes that no longer exist, those nodes do not appear in the UI of the backend. When a user attempts to remove a node from the list of selected nodes, the UI appears to use an index-based removal process, but the index it passes is based on the number of existing nodes, not the total number of nodes referenced by the control. On the other hand, the code that performs the deletion uses the full list of node references, deleted nodes included. This discrepancy means that the wrong node is removed from the picker.

Steps to reproduce

  1. Create a doctype of "Location" and build 4 locations (e.g. Location A - D).
  2. Create a doctype of "Basic" containing a property of "Locations" which is a property of type Multinode Treepicker.
  3. Creates a "Basic" node and populate the "Locations" property with all 4 locations.
  4. Delete the second Location node -- the actual node, not its reference in the picker -- (e.g. Location B) and empty the Trash.
  5. Revisit the "Locations" property on the "Basic" node; the list should now show 3 locations (e.g. Location A, C, and D).
  6. Attempt to remove the last location (e.g. Location D) from the picker.

Expected result / actual result

I expect the last location to disappear from the picker. Instead, the next-to-last location disappears.

Note that the first location (Location A) could be accurately removed in this scenario. Further, if the second location (Location C) were clicked, it would actually remove the invisible reference to the deleted location (Location B) with no apparent change to the list in the UI.

I propose that the remove function is updated to reference the specific node key (GUID) rather than the index, so that the removal process can accurately remove the proper node.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions