Skip to content

checkBindingNoChanges does not get unwrapped old values when checking for ExpressionChangedAfterItHasBeenCheckedError #18129

@victornoel

Description

@victornoel

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

When using impure pipes, the value is wrapped, for example with async.
Sometimes this makes the developer mode of Angular throw the error ExpressionChangedAfterItHasBeenCheckedError because checkBindingNoChanges gets a wrapped value as the old value and an unwrapped value as the new value even though they did not change (I simply looked at the values via the chromium debugger)

Expected behavior

Either checkBindingNoChanges should unwrap values if needed or get unwrapped values from its caller.

Minimal reproduction of the problem with instructions

Couldn't reproduce it: I think it happens in some complex scenario where the order of initialisation of the component and the moment data is received via an observable is not usual.

Note that my observables are initialized in ngOnInit and simply bound in the template via obs$ | async without anything else specific. I don't see how it could be simpler than that, none of the usual ways of fixing ExpressionChangedAfterItHasBeenCheckedError can even be applied!

I guess the problem existed before but since 4.2.x the checks are stricter and now the problem shows itself.

Environment


Angular version: 4.2.6


Browser:
- [x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions