Skip to content

Updates to values prop in onChange callback are ignored #260

Description

@RookY2K

I've got a use-case that doesn't seem well supported by react-dropdown-select(RDS). I am attempting to use RDS as the base for a Tree component, but there seems to be some inconsistencies with how the component handles prop updates under the hood. I've got a codesandbox that reproduces the issue that I'll spell out below.

https://codesandbox.io/s/rds-values-prop-inconsistent-fkpr23

In this setup, A1 and A2 are considered children of A.

Desired interactions:

  1. Select A -> A1 and A2 become selected
  2. Do (1) then Deselect A -> Deselects A1 and A2
  3. Do (1) then Deselect A1 or A2 -> Deselects A

Actual interactions:

  1. Does what is desired
  2. Only deselects A and leaves A1 and A2 selected
  3. Only deselects A1 or A2 and leaves A and the other child selected

I added some simple console.log statements that show the individual processing steps. I also added a console.warn to show what the actual value of the values prop is immediately prior to setting it as a prop for RDS. For both interactions (2) and (3), the values prop has the correct value.

Screenshots
(2)
image

image

(3)
image

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions