-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Dialog causes ExpressionChangedAfterItHasBeenCheckedError #5004
Comments
in 5.0.2 version, this error disapper |
We have the same problem, without using datatables. For us some Angular Material styles are giving the error. Reverting PrimeNG to 5.0.2 removed the error. I think it should be found in the dialog component, not in the datatable |
I have the same problem with a listbox inside a dialog. I've created a plunkr for this: |
I get a very similar error on form inputs on a dialog after upgrading to PrimeNG 5.2 and Angular 5.2 on the Barcelona theme. If my first input is a dropdown or an autocomplete element on the dialog I get It seems like the first input element on the form get's auto focused on the dialog opening and that is causing the issue in my case, don't think it auto focused on 5.02 |
Same problem as @palamethos with Ultima theme and form inputs on dialogs. |
I'm getting the same error, but for |
Same here, @walter-psjr |
Same here. Is there any news about this issue? |
This is caused by #4686. If the first element in dialog is focusable you will get this error. As I wrote there, this feature should be optional. |
same here |
This is probably angular issue angular/angular#6005 (comment) |
I don't think so. Prod mode doesn't do the check for values changing while change detection is happening, but that doesn't mean it isn't happening. Just that the error isn't being thrown. The PrimeNG code needs to change to ensure that values aren't changing during change detection (which didn't start happening until PrimeNG 5.2). |
I agree. This is not an angular issue. I also use onPush changeDetectionStrategy and yet I see the error, |
So this happens when there is a dialog around? This famous error is too common in dev mode and caused when something changes after angular runs change detection. |
Thanks @cagataycivici I'll give this a try when the next version drops! |
I'm still seeing this issue (with just a button) after the fix. I think the issue is caused by the focus() method getting called from the ngAfterViewChecked life cycle hook. If I (temporarily) change my local PrimeNG dialog.js file from ngAfterViewChecked to ngAfterContentChecked, the issue is resolved. I think this is because content projection hasn't completed yet during the ngAfterViewChecked hook. |
Anyone else still having this after 5.2.3? |
Not anymore for my use case 👍 Thank you |
5.2.3 good here. Thanks. |
It works for me as well. Thanks |
@cagataycivici I still get this error with 5.2.3 using p-autocomplete and [disabled]: |
I can verify with 5.2.3 I don't have the problem anymore. |
@cagataycivici I still get the error with 5.2.3 with a edit: If I tab the focus away from the |
I am facing the same issue in my code while changing p-dropdown and opening a modal. But when I created plunkr to show the issue. It actually works in plunkr. Here is the link if it helps anyone. primeng version |
I still get this error when using the onChange of a p-checkbox to show a confirm dialog. |
As my very smart colleague do to fix this, just put a input type hidden on top of the form in the dialog. |
For everyone having the problem with a ConfirmDialog, I've got a workaround/fix for this: ConfirmDialog.prototype.ngAfterViewChecked = function () {
if (this.executePostShowActions) {
setTimeout(() => {
this.domHandler.findSingle(this.el.nativeElement.children[0], 'button').focus();
this.executePostShowActions = false;
}, 0);
}
} Just put this monkey-patching code into one of your TS files. |
This workaround works for me - but then the dialog is not centered anymore... |
This still exists in 5.2.4 |
And also in 5.2.5... |
And also in PrimeNG 6.0.0-beta.1 Found the issue for me . It was connected with [visible]="some_method()" (visibleChange)="visibleDialog = null" . some_method was returning first null and after first check non boolean value |
I get this error (using 5.2.6) if I try to display a dialog when the value of a p-dropdown changes. It works fine if using a button to flip the display flag. Note that I don't get the error if I break into and step through the onChange function.
|
I am facing the same issue in my code when try set [activeIndex]="0" ` <p-accordion [activeIndex]="0"> ` |
thanks @Pikadili83 , that resolve my problem, I had a multiselect of primeng first, then I changed it to be the 2 element in my pdialog and it works, this resolves my problem |
It exists for dropdown components even with version 6.1.4 when opening a modal dialog upon dropdown option selection |
got a slight workaround template: <p-dropdown *ngIf="showDropdown" (onChange)="updateValue($event.value)"></p-dropdown> controller (wherever the code errors. in my case, whenever i open a confirm dialog): updateValue(value: string) {
this.showDropdown = false;
setTimeout(() => (this.showDropdown = true));
// stuff that causes the ExpressionChangedAfterItHasBeenCheckedError error...
} |
By default focusOnShow is TRUE. i.e first button receives focus on show. |
I'm submitting a ... (check one with "x")
[ ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
The text was updated successfully, but these errors were encountered: