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

[React] IxSelect not showing initial selected value #1554

Closed
2 tasks done
OG84 opened this issue Nov 7, 2024 · 2 comments · Fixed by #1548
Closed
2 tasks done

[React] IxSelect not showing initial selected value #1554

OG84 opened this issue Nov 7, 2024 · 2 comments · Fixed by #1548
Labels
triage We discuss this topic in our internal weekly

Comments

@OG84
Copy link

OG84 commented Nov 7, 2024

Prerequisites

  • I have read the Contributing Guidelines.
  • I have not leaked any internal/restricted information like screenshots, videos, code snippets, links etc.

What happened?

When using <IxSelect> with dynamically populated nested <IxSelectItem>'s, the initial value (using value prop) is not selected correctly.

When using the deprecated selectedIndices prop, the initial value is shown correctly.

This must have something to do with the change detection when IxSelectItems are changed dynamically after the parent IxSelect has been rendered.

This bug only occurs for dynamic IxSelectItems. For static hard coded values it is working fine.

Please see my stackblitz.

Edit: Seems like when setting the value prop AFTER the items have been initialized it is working.
(e.g. setSelectedValue('2') inside the callback, see example code)

What type of frontend framework are you seeing the problem on?

React

Which version of iX do you use?

v2.5.0

Code to produce this issue.

https://stackblitz.com/edit/react-hsbjhb?file=src%2FApp.js
@OG84 OG84 added the triage We discuss this topic in our internal weekly label Nov 7, 2024
@OG84
Copy link
Author

OG84 commented Nov 8, 2024

ok so it seems like the same bug is present with selectedIndizes. But due to the fact that I'm supplying a new array instance on each render, in my example it looks like it's working. Without wrapping the selectedIndizes in a new array each time, the same problem occurs.

@matthiashader matthiashader linked a pull request Nov 12, 2024 that will close this issue
8 tasks
@matthiashader
Copy link
Collaborator

Closes via #1548.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage We discuss this topic in our internal weekly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants