Skip to content

Commit

Permalink
Fix primefaces#6044: Autocomplete reset selectedItem if value cleared
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Feb 26, 2024
1 parent a2a2f11 commit 363be01
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/lib/autocomplete/AutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export const AutoComplete = React.memo(

const updateModel = (event, value) => {
// #2176 only call change if value actually changed
if (selectedItem && ObjectUtils.deepEquals(selectedItem.current, value)) {
if (selectedItem.current && ObjectUtils.deepEquals(selectedItem.current, value)) {
return;
}

Expand Down Expand Up @@ -607,6 +607,8 @@ export const AutoComplete = React.memo(
});
}

selectedItem.current = null;

return null;
};

Expand Down

0 comments on commit 363be01

Please sign in to comment.