You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When utilizing the Dropdown component with the onFilterEvent callback to fetch options dynamically from a backend API, an issue occurs where the filter field automatically resets to an empty string if the filtering operation results in an empty array.
Reproducer
No response
PrimeReact version
10.6.2
React version
18.x
Language
ALL
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
Implement a call to remote API to fetch Dropdown options by a field value
Initialize a state variable that will hold the filter value
Use onFilter event in Dropdown to set the filter variable to event.filter
use useEffect to react to filter value change to fetch options
type a filter value that returns no result and filter value will be reset to empty string
Expected behavior
The filter value should not be reset
The text was updated successfully, but these errors were encountered:
melloware
added
Type: Bug
Issue contains a defect related to a specific component.
and removed
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
labels
Mar 31, 2024
thanks for your response! it is really weird, I created a StackBlitz and it works, but it just does not work in my project, what could be the issue on earth? the only difference is I am using it with react-hook-form
Describe the bug
When utilizing the Dropdown component with the onFilterEvent callback to fetch options dynamically from a backend API, an issue occurs where the filter field automatically resets to an empty string if the filtering operation results in an empty array.
Reproducer
No response
PrimeReact version
10.6.2
React version
18.x
Language
ALL
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
The filter value should not be reset
The text was updated successfully, but these errors were encountered: