primefaces / primefaces/primereact

DropDown: selected value not shown if not present in options list

Open
#8,510 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Needs Triage
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
  1. Click on dopdown to extend options
  2. Select an option in the list
  3. 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)
  4. 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

Image
Expected behavior

selected value is shown (or valueTemplate is rendered on screen)

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.