react-arborist icon indicating copy to clipboard operation
react-arborist copied to clipboard

Deselect not firing event

Open samirotiv opened this issue 1 year ago • 4 comments
trafficstars

On lines 341 to 345, there is a missing call to fire the tree.onSelect callback. This is preventing me from getting an updated list of selected nodes on deselection. I am using checkboxes for my implementation.

  deselect(node: Identity) {
    if (!node) return;
    const id = identify(node);
    this.dispatch(selection.remove(id));
  }

This needs to be:

  deselect(node: Identity) {
    if (!node) return;
    const id = identify(node);
    this.dispatch(selection.remove(id));
    safeRun(this.props.onSelect, this.selectedNodes);
  }

samirotiv avatar Feb 23 '24 10:02 samirotiv