primefaces / primefaces/primereact
DropDown: selected value not shown if not present in options list
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 8.3k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
If the user selects a value in the Dropdown component, then the list of options changes, so that this value is no longer in the list of options, the selected value is shown as blank (despite the component still having a value).
The component keeps the selected value, but it is not rendered.
Reproducer
https://stackblitz.com/edit/primereact-dropdown-custom-mnqewbpr?file=src%2FApp.tsx
System Information
primereact: ^10.9.7 => 10.9.7
react: ^19.2.0 => 19.2.4
tailwindcss: ^4.1.13 => 4.2.1
Steps to reproduce the behavior
- Click on dopdown to extend options
- Select an option in the list
- Do any action that will change the list of options (for example in the reproducer click on dropdown and search for something different than the current selected value)
- Value stays selected but it is not rendered in the dropdown
Note: If your search result does contain the selected option, the dropdown renders as expected. This bug is only replicated if the selected option is not in the list of options.
Note: valueTemplate is not rendered on screen when the option is not present in the list
Note: Possible regression of issue https://github.com/primefaces/primereact/issues/2644
Expected behavior
selected value is shown (or valueTemplate is rendered on screen)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducer in src/App.tsx and follow the Dropdown component behavior after the options change. Verify the case where the selected value is absent from the current options, including valueTemplate. Done means the selected value or its template remains visible after filtering removes that option.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100