Dropdown: optionValue is ignored if "value" is passed in through arbitrary objects
Describe the bug
Hello,
I'm not sure if this is expected behavior, but it seems that optionValue is being ignored if the arbitrary objects passed into options contains a value key.
I believe this issue is stemming from the fact that the entire arbitrary object is not being passed back in general from the onChange function.
My stackblitz fork demonstrates that only the value is being returned and not the entire object.
The reason why I believe this is an issue/bug is because onChange is expected to return the entire object since the type of the state variable selectedCity is the entire City object.
This is the line of code which I believe is causing this issue: https://github.com/primefaces/primereact/blob/master/components/lib/dropdown/Dropdown.js#L883
Please let me know if my interpretation is incorrect
Reproducer
https://stackblitz.com/edit/2wstkswe-9ohdqkvv?file=src%2FApp.tsx
System Information
System:
OS: macOS 15.6
CPU: (14) arm64 Apple M4 Pro
Memory: 66.22 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.19.0 - ~/.nvm/versions/node/v20.19.0/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v20.19.0/bin/npm
Browsers:
Chrome: 139.0.7258.155
Edge: 140.0.3485.54
Safari: 18.6
npmPackages:
primereact: ^10.8.3 => 10.8.5
react: ^17.0.2 => 17.0.2
Steps to reproduce the behavior
- Click on dropdown to open options
- Select a dropdown option
- Entire object from dropdown selection is not being returned as expected
Expected behavior
Entire selected object should be passed back from onChange function