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
Using AutoComplete component when I want to select the same value twice in a row there is a case when it doesn't work.
The case is when passing a dynamically build array to the suggestion property it keeps its references between renders.
In the provided CodeSandbox project when we first select the initialValue an event is fired but when it is selected again the event is not registered.
The same erroneous behavior is not applicable to inlineLabel due to the fact that its reference is recalculated on every render.
Also, for the suggestions list to appear we have to copy the array so it has a new reference, for it to appear.
Describe the bug
Using AutoComplete component when I want to select the same value twice in a row there is a case when it doesn't work.
The case is when passing a dynamically build array to the
suggestion
property it keeps its references between renders.In the provided CodeSandbox project when we first select the
initialValue
an event is fired but when it is selected again the event is not registered.The same erroneous behavior is not applicable to
inlineLabel
due to the fact that its reference is recalculated on every render.Also, for the suggestions list to appear we have to copy the array so it has a new reference, for it to appear.
Reproducer
https://codesandbox.io/s/primereact-autocomplete-suggestion-reference-bug-zzso64?file=/src/index.js
PrimeReact version
8.3.0
React version
18.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
Firefox/ Chrome
Steps to reproduce the behavior
inlineLabel
valueinlineLabel
value againinitialValue
valueinitialValue
value againDemo
valueDemo
value againExpected behavior
On steps 6 and 9 an "event" should be created.
The text was updated successfully, but these errors were encountered: