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

[Select]: Set default value no work #10537

Open
1 task done
pupss89345 opened this issue Jan 9, 2025 · 6 comments · May be fixed by #10904
Open
1 task done

[Select]: Set default value no work #10537

pupss89345 opened this issue Jan 9, 2025 · 6 comments · May be fixed by #10904
Assignees

Comments

@pupss89345
Copy link

Describe the bug

As title said the Select component set value is no work,,,,
<Select value="Orange" valueState="None" > <Option>Apple</Option> <Option>Orange</Option> </Select>

I set value is Orange but always apple as default value

Isolated Example

No response

Reproduction steps

1.Set Select Value as Orange
2.show wrong result
3.
...

Expected Behaviour

No response

Screenshots or Videos

No response

UI5 Web Components for React Version

2.5.0

UI5 Web Components Version

2.5.0

Browser

Edge

Operating System

Win11

Additional Context

No response

Relevant log output

Organization

No response

Declaration

  • I’m not disclosing any internal or sensitive information.
@Lukas742
Copy link
Collaborator

Lukas742 commented Jan 9, 2025

Hi @pupss89345

I wasn't able to reproduce this: https://stackblitz.com/edit/github-vdvctzza?file=src%2FApp.tsx

Please see the linked StackBlitz example and let me know if I missed something.

@pupss89345
Copy link
Author

pupss89345 commented Jan 9, 2025

Hi
Lukas your reproduce is the same as my code, but I don't know why your is work 🤔

Image

Maybe is our components version is different ??
Image

@Lukas742
Copy link
Collaborator

Lukas742 commented Jan 9, 2025

Hmm, this is strange. I've updated the example to use only 2.5.0 of both ui5-webcomponents and ui5-webcomponents-react packages and the behavior is still the same: https://stackblitz.com/edit/github-vdvctzza-dtwarrta?file=src%2FApp.tsx

Could you check which version of @ui5/webcomponents and @ui5/webcomponents-react is actually installed?

  • npm: npm list @ui5/webcomponents, npm list @ui5/webcomponents-react
  • yarn: yarn why @ui5/webcomponents, yarn why @ui5/webcomponents-react

@pupss89345
Copy link
Author

Hi Lukas
my version
Image

@pupss89345
Copy link
Author

Maybe I found the issue. It could be due to the way I created the React project and the UI5 components causing a conflict. I created the project using:
npx create-react-app my-app --template typescript
And now, updating React to version 19 is causing issues, so I downgraded it to version 18 by following these steps:

  1. npm uninstall react react-dom
  2. npm install react@18 react-dom@
  3. npm install --no-audit --save @testing-library/jest-dom@^5.14.1 @testing-library/react@^13.0.0 @testing-library/user-event@^13.2.1 web-vitals@^2.1.0

Then I added:
npm install @ui5/webcomponents @ui5/webcomponents-react @ui5/webcomponents-fiori

And then Select component set Value don't work.
I also tested the following Vite version, which works fine with your code:

npx degit SAP/ui5-webcomponents-react/templates/vite-ts#main my-project

@Lukas742
Copy link
Collaborator

I've tested the behavior and can confirm that it occurs when using create-react-app. Please note that the create-react-app project is not maintained anymore and is therefore not recommended to be used anymore.

Since the Select component is a web component developed by the ui5-webcomponents team, I'm going to forward this issue to their repo.


Hi Colleagues,

when using create-react-app (not maintained anymore) to set up a React application, the value property of the Select component is not working as intended. This behavior does not occur when bootstrapped with Vite or Next.js for example.

I've created an example which you can check out by forking this repo.

Reproduction steps

  1. Fork https://github.com/Lukas742/ui5wcr-cra
  2. checkout branch issue/6800-select
  3. install modules: npm i
  4. run dev server: npm run dev
  5. See that both Selects show "Apple" instead of "Orange" initially

@Lukas742 Lukas742 transferred this issue from SAP/ui5-webcomponents-react Jan 13, 2025
@ilhan007 ilhan007 self-assigned this Jan 17, 2025
@ilhan007 ilhan007 linked a pull request Feb 24, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

3 participants