Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete: deleting search term causes ExpressionChangedAfterItHasBeenCheckedError #14001

Closed
ghost opened this issue Nov 2, 2023 · 4 comments
Assignees
Labels
LTS-FIXED-14.2.16 LTS-FIXED-15.4.13 Fixed in PrimeNG LTS 15.4.13 LTS-PORTABLE Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@ghost
Copy link

ghost commented Nov 2, 2023

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

  1. go to and run https://stackblitz.com/run?file=src%2Fapp%2Fdemo%2Fautocomplete-template-demo.ts
  2. type random string to autcomplete
  3. delete the string by pressing backspace
  4. when the last character is remove, an error is thrown

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

@ghost ghost added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 2, 2023
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 2, 2023
@cetincakiroglu cetincakiroglu self-assigned this Nov 2, 2023
@cetincakiroglu cetincakiroglu added this to the 16.8.0 milestone Nov 2, 2023
@cetincakiroglu
Copy link
Contributor

Hi,

With version 16.7.0, we have released the first part of the accessibility implementation for inputs that we have been working on for a long time. Based on the research we conducted during the implementation, we decided that many components needed changes in their structure and simplification, and these components were rewritten. Unfortunately, after extensive testing, there may be unexpected and unforeseen bugs that have emerged. We are grateful for your reports, and we are working to address them in the upcoming release!

@cetincakiroglu
Copy link
Contributor

cetincakiroglu commented Nov 4, 2023

Hi,

I couldn't reproduce it on demos and your example doesn't start please provide a working example so I can see the error and identify it clearly.

@cetincakiroglu cetincakiroglu added the Resolution: Needs Revision The pull request can't be merged. Conflicts need to be corrected or documentation and code updated. label Nov 4, 2023
@ghost
Copy link
Author

ghost commented Nov 6, 2023

Hi @cetincakiroglu , it is not my demo, it is demo from your AutoComplete documentation. It also did not worked for me in that split view where you see code and app in the same window. Try to open running app in new window once it is started (by the button on stackblitz), that way it worked for me.

Here is one of yours demo cloned:
https://stackblitz.com/edit/q2xbwb?file=src%2Fapp%2Fdemo%2Fautocomplete-dropdown-demo.html

2023-11-06_8-31-35.mp4

@cetincakiroglu cetincakiroglu modified the milestones: 16.7.1, 16.8.0, 16.7.2 Nov 6, 2023
@cetincakiroglu
Copy link
Contributor

@martin-kasa-swissre

Thanks for the explanation, it's difficult to catch because doesn't happen all the time. We'll take a look at it

@cetincakiroglu cetincakiroglu added LTS-PORTABLE and removed Resolution: Needs Revision The pull request can't be merged. Conflicts need to be corrected or documentation and code updated. labels Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTS-FIXED-14.2.16 LTS-FIXED-15.4.13 Fixed in PrimeNG LTS 15.4.13 LTS-PORTABLE Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

2 participants