Skip to content

Change Detection error (ExpressionChangedAfterItHasBeenCheckedError): Angular does not compare objects during checkNoChanges pass #20450

Closed

Description

@gilbertogwa

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

I had a problem with Change Detection when I set up an object in an @input property of a directive. I have identified that Angular warns only when the value is a primitive type (number, string, etc), for objects the error is not reported. The CD became infinite after I applied a jquery transformation to the element where the directive was applied. The problem is that the loop has crashed the browser.

  • Is it possible to put a lock in this situation (for example, ignore on 1000 errors)?
  • Is it intentional not to report change detection error when value is object?

Expected behavior

As expected behavior, I would like Angular to warn of CD errors for objects as well. Well, this is what I would like, but I do not know if there is any architectural or functional decision for this.
My problem was with jquery.select2, but there might be other types of libraries that would cause infinite error. So I wish there was a lock, at least from the CD when there was an X amount fired at a given time.

Minimal reproduction of the problem with instructions

See following link to reproduce error: https://stackblitz.com/edit/angular-select2-infinite-cd

Environment


Angular version: 5.0.0

Browser:
- [X] Chrome (desktop) version 62.0.3202.89
 
For Tooling issues:
- Node version: v7.8.0
- Platform:  Windows 10

Activity

  1. added
    area: core
    on Nov 15, 2017
  2. added this to the Backlog milestone on Feb 8, 2018
  3. modified the milestones: Backlog, needsTriage on Feb 26, 2018
  4. added
    P3
    and removed on Oct 1, 2020
  5. changed the title [-]Change Detection error (ExpressionChangedAfterItHasBeenCheckedError) infinite and hided when object value[/-] [+]Change Detection error (ExpressionChangedAfterItHasBeenCheckedError): Angular does not compare objects during checkNoChanges pass[/+] on Aug 18, 2021
  6. dylhunn commented on Jul 11, 2022

    @dylhunn
    Contributor

    Working as intended.

    #43187 (comment)

  7. angular-automatic-lock-bot commented on Aug 11, 2022

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  8. locked and limited conversation to collaborators on Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area: corecore: change detectionfreq1: lowtype: bug/fix

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions