primefaces / primereact

The Most Complete React UI Component Library
https://primereact.org
MIT License
6.99k stars 1.06k forks source link

Dropdown: Missing `optionLabel` property causes error #6518

Closed ewenjo closed 7 months ago

ewenjo commented 7 months ago

Describe the bug

When creating a Dropdown comp without the optionLabel property, opening the dropdown causes the page to error. When in the past it would properly default to "label".

This is especially a problem with RowsPerPageDropdown in Paginator where you cannot simply add that prop.

Reproducer

https://stackblitz.com/edit/vitejs-vite-sswemw?file=src%2FApp.tsx

PrimeReact version

10.6.4

React version

18.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Create a Dropdown
  2. Don't set the optionLabel prop
  3. Click dropdown

Expected behavior

Not setting the optionLabel property should default to using "label".

Rekl0w commented 7 months ago

PR submitted.

ewenjo commented 7 months ago

It's the same case for optionValue as well. Omitting it causes the value to be wrong

Rekl0w commented 7 months ago

I tried it after PR, it works now. There is no need to make changes for optionValue