ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

Select doesn’t seem to set the selected option according to the `value` attribute

Open giladvidal opened this issue 1 year ago • 2 comments

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

  1. open the app
  2. select a value
  3. click to next page
  4. 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.

giladvidal avatar Sep 18 '24 11:09 giladvidal

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

IlianaB avatar Sep 18 '24 14:09 IlianaB

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: image

Best regards, Petya.

PetyaMarkovaBogdanova avatar Oct 03 '24 08:10 PetyaMarkovaBogdanova

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!

github-actions[bot] avatar Oct 25 '24 00:10 github-actions[bot]

@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?

pskelin avatar Oct 28 '24 07:10 pskelin

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 useEffect call (e.g. a ui5-list might start with selection mode None and then it changes to Multiple during 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

MarcusNotheis avatar Oct 31 '24 15:10 MarcusNotheis

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.

ilhan007 avatar May 29 '25 06:05 ilhan007

This issue has been closed. To reopen, just leave a comment!

github-actions[bot] avatar May 29 '25 06:05 github-actions[bot]