react-select icon indicating copy to clipboard operation
react-select copied to clipboard

formatGroupLabel doesn't show element when the `options` is empty

Open danvc opened this issue 7 years ago • 2 comments

Bug

When a group element has the options empty, it doesn't show the element inside the list.

Take the example below Example: https://codesandbox.io/s/32zjq1x37m

We have the following groups:

export const groupedOptions = [
  {
    label: 'Colours',
    options: [],
  },
  {
    label: 'Flavours',
    options: flavourOptions,
  },
];

The element Colours should at least appear showing 0 elements, while it doesn't show the element Colours as option.

As we can see, we just get the Flavours while (IMHO) we should show the Colors and its length of options (in this case, 0) image

It's very helpful if we want to see a tree and, even a root doesn't contain leafs, it should show the grou/root element

danvc avatar Feb 08 '19 19:02 danvc

I prefer the current behavior because I'm not showing the count and seeing 'colours' over 'favours' would be visually awkward, but I could see a prop showEmptyGroupLabels being useful.

c-moss-talk avatar Mar 08 '19 03:03 c-moss-talk

Hello -

In an effort to sustain the react-select project going forward, we're closing old issues.

We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our efforts towards the current major version.

If you aren't using the latest version of react-select please consider upgrading to see if it resolves any issues you're having.

However, if you feel this issue is still relevant and you'd like us to review it - please leave a comment and we'll do our best to get back to you!

bladey avatar May 28 '20 06:05 bladey