jquense / react-widgets

Polished, feature rich, accessible form inputs built with React
http://jquense.github.io/react-widgets/
MIT License
2.34k stars 394 forks source link

Multiselect defaultValue doesn't refresh when props value changes #1135

Open Grumpier opened 2 years ago

Grumpier commented 2 years ago

Hi. I'm trying to use this widget to display tag selections made by the user inside another component rather than within Multiselect itself. The idea is that from within Multiselect, the user can see the tags currently inside the filter array and remove them, but selection of tags is done through the other component. I'm looking to achieve something like this:

image

The code is <Multiselect defaultValue={props.filter} /> However, the Multiselect component does not seem to be re-rendering when props.filter is changed.

If instead I try <Multiselect data={props.filter} /> the data does re-render.

Is there any workaround to force the component to re-render the default values when the hooked array changes?

Thanks for any help you can offer!

coder89 commented 1 year ago

some properties (like event handlers) are also not refreshing when they are changed for Combobox