Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EuiSuperSelect inputDisplay Does not support falsey values #7359

Closed
robert-seymour-numerated opened this issue Nov 13, 2023 · 2 comments · Fixed by #7362
Closed

EuiSuperSelect inputDisplay Does not support falsey values #7359

robert-seymour-numerated opened this issue Nov 13, 2023 · 2 comments · Fixed by #7362
Assignees
Labels

Comments

@robert-seymour-numerated
Copy link

robert-seymour-numerated commented Nov 13, 2023

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

@robert-seymour-numerated robert-seymour-numerated added bug ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible labels Nov 13, 2023
@robert-seymour-numerated robert-seymour-numerated changed the title EuiSuperSelect Does not support falsey values EuiSuperSelect inputDisplay Does not support falsey values Nov 14, 2023
@cee-chen cee-chen removed the ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible label Nov 14, 2023
@cee-chen cee-chen self-assigned this Nov 14, 2023
@cee-chen
Copy link
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} />

@robert-seymour-numerated
Copy link
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
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants