ic-ui-kit icon indicating copy to clipboard operation
ic-ui-kit copied to clipboard

Select: Unable to leave loading state without re-render?

Open GCHQ-Developer-299 opened this issue 1 year ago • 3 comments

Summary of the bug

Discovered whileintroducing Playground to ic-select

It seems that the loadingHandler function doesn't consider the loading prop changing to false

  @Watch("loading")
  loadingHandler(newValue: boolean): void {
    newValue && this.triggerLoading();
  }

Additionally, updating the loadingLabel prop doesn't change the loading text until loading is toggled off and back on.

🪜 How to reproduce

Tell us the steps to reproduce the problem:

  1. Go to the React Playground storybook in Select (single)
  2. click to expand the Select
  3. in the controls, toggle 'loading' to true
  4. you'll see the select switch to a loading state
  5. Toggle 'loading' to false
  6. The select won't show results, it remains loading. You'll find that expanding and collapsing the select doesn't fix it

📸 Screenshots or code

Screenshot 2024-06-14 at 15 37 35

🧐 Expected behaviour

Switching loading to false should show results / no results. Also, in the Playgrounds (single/searchable select in React, multi-select in Canary) the loadingLabel should update loading text whenever the prop is changed

GCHQ-Developer-299 avatar Jun 14 '24 14:06 GCHQ-Developer-299

This also applies to Multi-Select. After selecting multiple options & then setting loading to true the field contains 1 or more commas

image

then setting to false the loading state does not clear

If only a single value is selected & then loading is set to true, the placeholder text is black (should be grey) bad: image

good: image

ad9242 avatar Jul 04 '24 14:07 ad9242

may want to consider leaving this until after #2108 is complete

ad9242 avatar Jul 04 '24 14:07 ad9242

Summary of select/loading bugs following testing in Stackblitz and Storybook playground

Select Searchable select Multi-select
Toggling loading prop to false doesn't show results Present in storybook Present in storybook Present in storybook
"Clear selection" button next to placeholder text if loading is changed to true while value is selected Present in storybook and stackblitz Not present Present in storybook and stackblitz
Placeholder text is wrong colour if loading is changed to true while value is selected Not present Not present Present in storybook and stackblitz
Multiple selected values display as commas if loading is changed to true N/A N/A Present in stackblitz
User can use keyboard to select "loading" and "no results found" Present in stackblitz Present in stackblitz Present in stackblitz User can use search against current options in loading state N/A Present in storybook and stackblitz N/A

GCHQ-Developer-718 avatar Apr 30 '25 09:04 GCHQ-Developer-718