Select doesn’t seem to set the selected option according to the `value` attribute
Bug Description
When using Select/Option components, the value I set in 'value' in the Select is not set.
Affected Component
No response
Expected Behaviour
'value' should use the value.
Isolated Example
https://stackblitz.com/edit/github-hcyvzh?file=src%2FPageOne.jsx
Steps to Reproduce
- open the app
- select a value
- click to next page
- see the value not set ...
Log Output, Stack Trace or Screenshots
No response
Priority
High
UI5 Web Components Version
2.2.0
Browser
Edge
Operating System
Windows
Additional Context
No response
Organization
BDC-FOS
Declaration
- [X] I’m not disclosing any internal or sensitive information.
Hello @ui5-webcomponents-topic-p I am forwarding this issue to you, because it seems ui5-select does not react on value update.
Steps to reproduce are described above, although I believe the query parameter tenant_filter is not in sync with both pages, that's why I edited the sample a little: https://stackblitz.com/edit/github-hcyvzh-w5msb2?file=src%2FPageOne.jsx,src%2FPageTwo.jsx
Regards, Iliana
Hi @giladvidal,
are you sure you are setting the query parameters right?
I saw that logically the value that has been set to the ui5-select is not correct:
Best regards, Petya.
Hello, everyone! The issue has been inactive for 21 days. If there are still questions or comments, please feel free to continue the discussion. Inactive issues will be closed after 7 days!
@MarcusNotheis @Lukas742 This example will work if the react wrapper is setting the value as a property. Since you are guaranteed that this is a web component that is defined and has such a property, is there a reason not to switch to setting properties in general (like react 19 will be doing)?
We are also discussing to add attribute handling for this value property, but this is a more general discussion about better form support and setting properties from the wrappers is worth it on its own. What do you think?
We have some doubts of changing our lifecycle for React 18 due to the following reasons:
- It would be a breaking change because components could render with a different setting first and then some attributes might change in an
useEffectcall (e.g. aui5-listmight start with selection modeNoneand then it changes toMultipleduring the first render cycle) - Server Side Rendering might become an issue: Every tag would be rendered without attributes and then we'll add all the properties via an effect. This will then result in the webcomponent reflecting these properties to attributes and this would be detected as an hydration diff which could force your whole app to rerender
- Our current approach is fine with React 19, so we would have to implementations depending on the react version which is something I would like to avoid to be honest
HI @giladvidal we enhanced the value prop handling with this change that addresses your problem and it's available since 2.9.0.
Feel free to give a try and get back to us if you need further assistance.
This issue has been closed. To reopen, just leave a comment!