mi6 / ic-ui-kit

Intelligence Community UI Kit (based on StencilJS)
MIT License
19 stars 22 forks source link

Changing the values of props on the multi-select resets any selected options #2044

Open GCHQ-Developer-847 opened 1 week ago

GCHQ-Developer-847 commented 1 week ago

Summary of the bug

When the multi-select has options selected, if the values of any props are changed, the selected options are cleared.

🪜 How to reproduce

Tell us the steps to reproduce the problem:

  1. Go to the playground for the multi-select (this will be available as part of ticket 1970).
  2. Select some options in the multi-select.
  3. Change any of the prop values using the playground controls.
  4. See that the selected options in the multi-select are cleared.

🧐 Expected behaviour

The selected options should stay when any props are changed.

Additional info

This is quite a serious bug as there will be many cases when the developer may need to change props after the multi-select has already loaded (validation status in particular).

ad9242 commented 5 days ago

Think this is only a storybook issue - can be resolved by using the useArgs hook

This has been implemented in checkbox playground to keep the checked prop in sync when user interacts with the actual checkbox