Skip to content

EuiSuperSelect inputDisplay Does not support falsey values #7359

Closed

Description

Describe the bug
for EuiSuperSelect, if the option values are falsey, then the valueOfSelected prop will not properly display the label when the falsey option is selected

Example options prop

[
    { value: true, inputDisplay: "True Display" },
    { value: false, inputDisplay: "False Display" },
]

Example GIF
CleanShot 2023-11-13 at 16 31 57

Impact and severity

Environment and versions

  • EUI version 76.0.0 (Though I believe it impacts the latest version as well):
  • React version:
  • Kibana version (if applicable):
  • Browser:
  • Operating System:

Expected behavior
A selected option of false would still render the display label for the super select

Minimum reproducible sandbox
It is extremely helpful for us if you are able to reproduce your issue in a minimum reproducible sandbox (visit our docs site and click the CodeSandbox logo in the top-right corner).

Additional context

I believe the source is located here. We are guarding against an undefined selectedOption, but that is too broad and will filter out false as well

Activity

  1. added
    ⚠️ needs validation
    on Nov 13, 2023
  2. changed the title [-]EuiSuperSelect Does not support `falsey` values[/-] [+]EuiSuperSelect `inputDisplay` Does not support `falsey` values[/+] on Nov 14, 2023
  3. removed
    ⚠️ needs validation
    on Nov 14, 2023
  4. self-assigned this
    on Nov 14, 2023
  5. cee-chen commented on Nov 14, 2023

    @cee-chen
    Contributor

    Great catch on this @robert-seymour-numerated! We should have a fix next week for this in #7362.

    Not sure if you're using Typescript for your project, but I noticed typing values to be non-strings was also broken - that should also be fixed now, allowing you to do, e.g. <EuiSuperSelect<boolean> valueOfSelected={false} />

  6. robert-seymour-numerated commented on Nov 14, 2023

    @robert-seymour-numerated
    Author

    @cee-chen You are the best, thanks! We do use Typescript, and I'll take a look at the generic fixes for our project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions