Autocomplete: deleting search term causes ExpressionChangedAfterItHasBeenCheckedError #14001
Labels
LTS-PORTABLE
Issue's fix will be ported to supported LTS versions
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
When typing anything to autocomplete, then deleting it, after deleting last character there is ExpressionChangedAfterItHasBeenCheckedError error throw.
it can be simulated in your example stackblitz anvironment
From the code it looks like the problem is that there are two different ways how "filled" property is set. One in "writeValue" is checking length of the value. which is in case of empty string set to "false" but in "inputValue = computed(() =>" , there is ObjectUtils.isNotEmpty(this.modelValue()) used, which is resolving empty string to "true"
Environment
your demo.
Reproducer
https://stackblitz.com/run?file=src%2Fapp%2Fdemo%2Fautocomplete-template-demo.ts
Angular version
16.2.0
PrimeNG version
16.7.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18
Browser(s)
all
Steps to reproduce the behavior
ERROR Error: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'. Expression location: AutocompleteTemplateDemo component. Find more at https://angular.io/errors/NG0100
Expected behavior
no error
The text was updated successfully, but these errors were encountered: