carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.86k stars 1.82k forks source link

[React] MultiSelect count of items selected through initialSelectedItems is wrong and other issues #4297

Closed tahaimt closed 5 years ago

tahaimt commented 5 years ago

What package(s) are you using?

Detailed description

MultiSelect is not showing correct count of initialSelectedItem, neither is it updating on the state update of the variable fed in initialSelectedItem.

Steps to reproduce the issue

  1. On page load, the count of initialSelectedItems is wrong (2 selected but the control shows 1).
  2. None of the items are shown as selected in the expanded selection dropdown.
  3. After 3 second of page load, the state used in initialSelectedItem is changed (count of selected items is changed from 3 to 2), however the change does not reflect in the control.

Link for CodeSandBox

Please take a look at the codesandbox link to view the bug in action CodeSandBox Link

asudoh commented 5 years ago

Hi 👋 thank you for reporting - As the name says, initialSelectedItem is for the initial state only and not for subsequent updates (which means programmatic control over the list of selected items). For such advanced use case, I'd suggest using the underlying presentational components behind <MultiSelect> for now (you'll need #4249 for that).

tahaimt commented 5 years ago

Are underlying presentational components exposed in recent versions?

asudoh commented 5 years ago

No, but feel free to enter a PR for that!

stale[bot] commented 5 years ago

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. You can keep the conversation going with just a short comment. Thanks for your contributions.

stale[bot] commented 5 years ago

As there's been no activity since this issue was marked as stale, we are auto-closing it.