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

[BUG] - Select #3062

Closed
zMohammadz84 opened this issue May 23, 2024 · 7 comments · Fixed by #3081
Closed

[BUG] - Select #3062

zMohammadz84 opened this issue May 23, 2024 · 7 comments · Fixed by #3081
Assignees
Labels
🐛 Type: Bug Something isn't working

Comments

@zMohammadz84
Copy link

NextUI Version

2.3.6

Describe the bug

When nothing is selected. The placeholder is not displayed . When using onChange .

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

When nothing is selected. The placeholder is not displayed . When using onChange .

Expected behavior

When the state associated with the select component is empty, the placeholder will be displayed, and when the user clicks on one of the select options and chooses, the placeholder will be hidden and what the user entered will be displayed.

Screenshots or Videos

No response

Operating System Version

Windows 11 Home V-23H2

Browser

Chrome

Copy link

linear bot commented May 23, 2024

ENG-880 [BUG] - Select

@wingkwong
Copy link
Member

I couldn't reproduce the issue. Can you share some code / video for demonstrating the issue?

image

@zMohammadz84
Copy link
Author

zMohammadz84 commented May 23, 2024

Screenshot 2024-05-23 151412
image

Recording.2024-05-23.152523.mp4

@wingkwong
Copy link
Member

I think it was due to selectedKeys. filterBy is probably empty which is not the correct key and results in rendering an empty value.

@zMohammadz84
Copy link
Author

I think it was due to selectedKeys. filterBy is probably empty which is not the correct key and results in rendering an empty value.

Yes, it is true that filterBy may be empty because the initial value is from searchParams. But the placeholder should be displayed when the state is empty. In the document itself, the placeholder is empty and is not displayed . Is there a solution ?

@ryo-manba
Copy link
Member

For the controlled component, it seems that state.selectedItems becomes [] due to the following condition, which causes the placeholder not to be returned.

if (!state.selectedItems) return placeholder;

I'll fix this. Thank you for reporting the issue!

@zMohammadz84
Copy link
Author

You're welcome
Thank You 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants