Closed dannysun2 closed 5 years ago
Hi @dannysun2 Thank you for your issue.
It seems that we've never implemented the component as a controlled component, meaning that the selectedItems is basically used for initialization at this point. I believe it would make a lot of sense to make the component work in a controlled state and I think the solution is quite simple if I'm honest.
I can't commit on a timeline at this point for a fix so I'd like to encourage you to contribute a solution to this. I think using a lifecycle method to update the selectedItems in the state in case that the selectedItems are defined and changed should most likely solve this.
Please let me know if you're interested in issuing a PR. Otherwise, I hope we can get someone on this a little later in the future.
Thanks again!
Controlled component feature implemented in #160
As fix was pushed , I close thread
Expected Behavior
Removing names (state.options) from list via onclick results in a re-render should result in an updated selectedItems list to reflect the changes from the state.
https://github.com/dannysun2/react-multi-select
Actual Behavior
While the component re-renders, the selectedItems list fails to reflect the new state changes.
Steps to Reproduce the Problem