Hide GlTokenSelector no results message while loading

What does this MR do?

Why

While GlTokenSelector is loading and has no dropdown items yet, GlTokenSelectorDropdown renders both the loading item ("Searching...") and the no results item ("No matches found"). Users see "No matches found" before the search has returned, which is confusing.

This shows up in GitLab in the organization user invite modal (organization_users_token_select.vue), reported in gitlab-org/gitlab#629302 (closed), and in any other token selector that sets loading while dropdown-items is empty.

What

  • Only render the no results item when loading is false.
  • Add a spec that asserts only the loading item renders while loading is true and there are no dropdown items.
  • Changeset for a @gitlab/ui patch release.

After this is released and GitLab picks up the new @gitlab/ui version, gitlab-org/gitlab#629302 (closed) is fixed without changes to the organization component.

References

Related to gitlab-org/gitlab#629302 (closed)

This contribution was prepared with the help of an AI assistant. I reviewed the changes and take responsibility for them.

Merge request reports

Loading
Loading