Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deselect not firing event #224

Open
samirotiv opened this issue Feb 23, 2024 · 4 comments · May be fixed by #289
Open

Deselect not firing event #224

samirotiv opened this issue Feb 23, 2024 · 4 comments · May be fixed by #289

Comments

@samirotiv
Copy link

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);
  }
@jakubbania94
Copy link

@jameskerr hey, can we get some attention here and merge a fix asap? This is a critical issue that needs to be solved.

It is reproducible on provided Demos, best visible on: https://react-arborist.netlify.app/cities on "Selected Items:" card counter

@drmp13
Copy link

drmp13 commented Apr 15, 2024

Up

@msukmanowsky
Copy link

Agree that this package should take care of this, but just noting that it's pretty easy to implement this when you have your own Node type:

function CustomNode({
  tree,
  node,
  style,
}: NodeRendererProps<MyCustomTreeItem>) {
  // You can access tree.props.onSelect and do tree.props.onSelect(tree.selectedNodes) after a deselect
}

@goliney
Copy link

goliney commented Sep 10, 2024

Here is the bug demonstration:

Sep-10-2024.17-32-45.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants