René's URL Explorer Experiment


Title: Show more details with the ExpressionChangedAfterItHasBeenCheckedError warning · Issue #18970 · angular/angular · GitHub

Open Graph Title: Show more details with the ExpressionChangedAfterItHasBeenCheckedError warning · Issue #18970 · angular/angular

X Title: Show more details with the ExpressionChangedAfterItHasBeenCheckedError warning · Issue #18970 · angular/angular

Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [x] Feature request [ ] Documentation issue or request [ ] Support request => Please do not submit support request here...

Open Graph Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [x] Feature request [ ] Documentation issue or request [ ] Support request => P...

X Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [x] Feature request [ ] Documentation issue or request [ ] Support request ...

Opengraph URL: https://github.com/angular/angular/issues/18970

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Show more details with the ExpressionChangedAfterItHasBeenCheckedError warning","articleBody":"## I'm submitting a...\r\n\u003c!-- Check one of the following options with \"x\" -->\r\n\u003cpre>\u003ccode>\r\n[ ] Regression (a behavior that used to work and stopped working in a new release)\r\n[ ] Bug report  \u003c!-- Please search GitHub for a similar issue or PR before submitting -->\r\n[x] Feature request\r\n[ ] Documentation issue or request\r\n[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n\u003c/code>\u003c/pre>\r\n\r\n## Current behavior\r\nThe current warning message `ExpressionChangedAfterItHasBeenCheckedError` is telling us what are the values before and after the change detection, but there aren't enough information to help to debug.\r\n\r\nWe are never sure what object or property is referring to. Also, the lines are not always reliable.\r\n\r\nIn some cases, we use an array of objects and messages like so are provided:\r\n```\r\nERROR Error: ExpressionChangedAfterItHasBeenCheckedError: \r\nExpression has changed after it was checked. \r\nPrevious value: 'undefined'. Current value: '[object Object],[object Object]'.\r\n    at viewDebugError (errors.ts:30)\r\n    at expressionChangedAfterItHasBeenCheckedError (errors.ts:29)\r\n    at checkBindingNoChanges (util.ts:145)\r\n    at checkNoChangesNodeInline (view.ts:477)\r\n    at checkNoChangesNode (view.ts:568)\r\n    at debugCheckNoChangesNode (services.ts:557)\r\n    at debugCheckDirectivesFn (services.ts:466)\r\n    at Object.View_App_0._co [as updateDirectives] (App.html:7)\r\n    at Object.debugUpdateDirectives [as updateDirectives] (services.ts:443)\r\n    at checkNoChangesView (view.ts:378)\r\n```\r\n\r\nI can see the file name is `(App.html:7)`, so I presume is something in my template, but it's not clear what it is. Also, note that my bug should be on line 2 (`\u003cdiv *ngIf=\"testObject\">`), and not on **line 7** as mentioned by angular.\r\n\r\n## Expected behavior\r\nPerhaps, it would be nice adding to the warning message the property/object that has changed its value.\r\n\r\nI would expect the warning message being something like so, instead:\r\n```\r\nERROR Error: ExpressionChangedAfterItHasBeenCheckedError: \r\nExpression has changed after it was checked. \r\nPrevious testObject value: 'undefined'. Current testObject value: '[{a: 1, b: 2}, {a: 3, b: 4}]'.\r\n```\r\n> PS: note the `testObject` key from my App class, also the values from object as string.\r\n\r\n**In that case, it would be easier to debug that the object is `testObject`;**\r\n\r\n## Minimal reproduction of the problem with instructions\r\nThis plunker can give an example of the context provided by angular. http://plnkr.co/edit/mX6REf9oidrVeURCvTZG?p=preview\r\n\r\n> This plunker is a fork from @adrienboulle from #14748 (comment)\r\n\r\n```ts\r\n@Component({\r\n  selector: 'my-app',\r\n  template: `\r\n    \u003cdiv>\r\n      \u003cdiv *ngIf=\"testObject\">\r\n          Object exists\r\n      \u003c/div>\r\n      \u003cdiv class=\"image-container\"\r\n       [ngStyle]=\"{\r\n         'height': getHeightPx()\r\n       }\">\r\n        \u003cimg alt=\"image\" style=\"height: 100%\" [src]=\"getUrl()\"/>\r\n        \r\n      \u003c/div>\r\n    \u003c/div>\r\n  `,\r\n})\r\nexport class App implements AfterViewInit {\r\n  img: Image;\r\n  isLoaded: boolean = false;\r\n  testObject: any;\r\n\r\n  constructor(private elementRef: ElementRef) {}\r\n\r\n  public ngAfterViewInit(): void {\r\n    this.img = this.elementRef.nativeElement.querySelector('img');\r\n    this.isLoaded = true\r\n    \r\n    this.testObject = [{a: 1, b: 2}, {a: 3, b: 4}];\r\n  }\r\n\r\n  public getUrl(): string {\r\n    return 'https://angular.io/resources/images/logos/angular2/angular.png';\r\n  }\r\n  \r\n  public getHeightPx(): string {\r\n    if (!this.isLoaded)\r\n      return '0px';\r\n\r\n    return '100px';\r\n  }\r\n}\r\n```\r\n\r\nIf you comment line 33: `// this.testObject = [{a: 1, b: 2}, {a: 3, b: 4}];`, you will end up with another bug with the same issue, but now, referring to the `getHeightPx()` method which was pointed by @adrienboulle on the issue #14748.\r\n\r\n```\r\nApp.html:9 ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: \r\nExpression has changed after it was checked. Previous value: '0px'. Current value: '100px'.\r\n```\r\n\r\nIn that case, it's much easier to debug. The line 9 is correct.\r\nAlso, because of its values (`'0px'` and `'100px'`), it is easier to find the property. However, the message error could have the missing `getHeightPx()` method which would make the debugging easier.\r\n\r\n\r\n## What is the motivation / use case for changing the behavior?\r\n\u003c!-- Describe the motivation or the concrete use case. -->\r\nMake it easier to debug this popular error #18129 #17887 #17572 #15464 #14748 and many other issues.\r\n\r\n## Environment\r\n\r\n```\r\nAngular version: 4.3.6\r\n```\r\n\r\n","author":{"url":"https://github.com/leocaseiro","@type":"Person","name":"leocaseiro"},"datePublished":"2017-08-31T07:57:38Z","url":"https://github.com/angular/angular/issues/18970"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:456da4d4-6917-c8ba-4820-168678914df5
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB380:1F44:1220C2A:17BDC38:6B013FD5
html-safe-nonce873c4138fc13947f1d8790ae4e15b71da23d60b9462149949635a32d42c80936
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzgwOjFGNDQ6MTIyMEMyQToxN0JEQzM4OjZCMDEzRkQ1IiwidmlzaXRvcl9pZCI6IjQ1MTIyOTE1MzQ4NzEyODE2MjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac15f261dade87f076351503cd520f16d138ebfc516df1f5da082416faaa50c133
hovercard-subject-tagissue:254247909
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/18970/issue_layout
twitter:imagehttps://opengraph.githubassets.com/70747a20fa4298a986fe4a65fcf7a3b7e2891bc8b221c4c2237888b5ae31a6b5/angular/angular/issues/18970
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/70747a20fa4298a986fe4a65fcf7a3b7e2891bc8b221c4c2237888b5ae31a6b5/angular/angular/issues/18970
og:image:altI'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [x] Feature request [ ] Documentation issue or request [ ] Support request => P...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameleocaseiro
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/18970#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F18970
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F18970
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/18970
Reloadhttps://github.com/angular/angular/issues/18970
Reloadhttps://github.com/angular/angular/issues/18970
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues836 (836)https://github.com/angular/angular/issues
Pull requests141 (141)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/18970
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/18970
Show more details with the ExpressionChangedAfterItHasBeenCheckedError warninghttps://github.com/angular/angular/issues/18970#top
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
core: change detectionhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20change%20detection%22
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%22
feature: under considerationFeature request for which voting has completed and the request is now under considerationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%3A%20under%20consideration%22
hotlist: error messageshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22hotlist%3A%20error%20messages%22
Backloghttps://github.com/angular/angular/milestone/82
https://github.com/leocaseiro
leocaseirohttps://github.com/leocaseiro
on Aug 31, 2017https://github.com/angular/angular/issues/18970#issue-254247909
http://plnkr.co/edit/mX6REf9oidrVeURCvTZG?p=previewhttp://plnkr.co/edit/mX6REf9oidrVeURCvTZG?p=preview
@adrienboullehttps://github.com/adrienboulle
#14748https://github.com/angular/angular/issues/14748
@adrienboullehttps://github.com/adrienboulle
#14748https://github.com/angular/angular/issues/14748
#18129https://github.com/angular/angular/issues/18129
#17887https://github.com/angular/angular/issues/17887
#17572https://github.com/angular/angular/issues/17572
#15464https://github.com/angular/angular/issues/15464
#14748https://github.com/angular/angular/issues/14748
https://github.com/victornoel
victornoelhttps://github.com/victornoel
on Sep 3, 2017https://github.com/angular/angular/issues/18970#issuecomment-326797206
#17887https://github.com/angular/angular/issues/17887
IgorMinarhttps://github.com/IgorMinar
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
on Sep 20, 2017https://github.com/angular/angular/issues/18970#event-1256570534
https://github.com/ocombe
ocombehttps://github.com/ocombe
on Sep 20, 2017https://github.com/angular/angular/issues/18970#issuecomment-330861977
https://github.com/crowmagnumb
crowmagnumbhttps://github.com/crowmagnumb
on Oct 24, 2017https://github.com/angular/angular/issues/18970#issuecomment-339073669
https://github.com/leocaseiro
leocaseirohttps://github.com/leocaseiro
on Oct 24, 2017https://github.com/angular/angular/issues/18970#issuecomment-339147419
@crowmagnumbhttps://github.com/crowmagnumb
chuckjazhttps://github.com/chuckjaz
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%22
on Oct 27, 2017https://github.com/angular/angular/issues/18970#event-1314643035
https://github.com/slawojstanislawski
slawojstanislawskihttps://github.com/slawojstanislawski
on Dec 17, 2017https://github.com/angular/angular/issues/18970#issuecomment-352278859
https://github.com/alexzuza
alexzuzahttps://github.com/alexzuza
on Jan 15, 2018https://github.com/angular/angular/issues/18970#issuecomment-357595936
https://medium.com/@a.yurich.zuev/catch-angular-template-errors-like-a-pro-or-how-i-create-angular-demo-e98694977911https://medium.com/@a.yurich.zuev/catch-angular-template-errors-like-a-pro-or-how-i-create-angular-demo-e98694977911
ngbothttps://github.com/apps/ngbot
Backloghttps://github.com/angular/angular/milestone/82
on Jan 23, 2018https://github.com/angular/angular/issues/18970#event-1437547182
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
core: change detectionhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20change%20detection%22
on Mar 12, 2020https://github.com/angular/angular/issues/18970#event-3123499899
angular-robothttps://github.com/apps/angular-robot
feature: under considerationFeature request for which voting has completed and the request is now under considerationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%3A%20under%20consideration%22
on Jun 5, 2021https://github.com/angular/angular/issues/18970#event-4846757952
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
hotlist: error messageshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22hotlist%3A%20error%20messages%22
on May 11, 2022https://github.com/angular/angular/issues/18970#event-6589066213
https://github.com/pkozlowski-opensource
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
on May 11, 2022https://github.com/angular/angular/issues/18970#issuecomment-1123568987
https://stackblitz.com/edit/angular-ivy-zzuuml?file=src%2Fapp%2Fapp.component.tshttps://stackblitz.com/edit/angular-ivy-zzuuml?file=src%2Fapp%2Fapp.component.ts
https://user-images.githubusercontent.com/973550/167832550-df2ba028-bf13-4130-b187-cf02d7229df1.png
AndrewKushnirhttps://github.com/AndrewKushnir
on May 16, 2023https://github.com/angular/angular/issues/18970#event-9260160748
refactor(core): Improve `ExpressionChangedAfterItHasBeenCheckedError` (…https://github.com/angular/angular/commit/e68a774e9f513973141278fc30f1422793b2a5f2
…https://github.com/angular/angular/pull/50286
e68a774https://github.com/angular/angular/commit/e68a774e9f513973141278fc30f1422793b2a5f2
refactor(core): Improve `ExpressionChangedAfterItHasBeenCheckedError` (…https://github.com/angular/angular/commit/7c790f70ee7d816ce6d69ffb801dd64ec99e7c92
…https://github.com/angular/angular/pull/50286
7c790f7https://github.com/angular/angular/commit/7c790f70ee7d816ce6d69ffb801dd64ec99e7c92
jessicajaniukhttps://github.com/jessicajaniuk
on May 19, 2023https://github.com/angular/angular/issues/18970#event-9291022890
docs: added clarity in lifecycle event docs (#50145)https://github.com/angular/angular/commit/d963ecdf5057e68701f44dd9dabe0f45f9f9e5b7
#50145https://github.com/angular/angular/pull/50145
d963ecdhttps://github.com/angular/angular/commit/d963ecdf5057e68701f44dd9dabe0f45f9f9e5b7
docs: added clarity in lifecycle event docs (#50145)https://github.com/angular/angular/commit/2f1796f8f6299d78de7e286e5b836d8402bb7661
#50145https://github.com/angular/angular/pull/50145
2f1796fhttps://github.com/angular/angular/commit/2f1796f8f6299d78de7e286e5b836d8402bb7661
https://github.com/AndrewKushnir
AndrewKushnirhttps://github.com/AndrewKushnir
on Jun 29, 2023https://github.com/angular/angular/issues/18970#issuecomment-1613616352
#34454https://github.com/angular/angular/issues/34454
AndrewKushnirhttps://github.com/AndrewKushnir
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jun 29, 2023https://github.com/angular/angular/issues/18970#event-9680235936
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Jul 30, 2023https://github.com/angular/angular/issues/18970#issuecomment-1656973146
automatic conversation locking policyhttps://github.com/angular/angular/blob/8f24bc9443b3872fe095d9f7f77b308a361a13b4/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Jul 30, 2023https://github.com/angular/angular/issues/18970#event-9955762851
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/18970
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/18970
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
core: change detectionhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20change%20detection%22
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%22
feature: under considerationFeature request for which voting has completed and the request is now under considerationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%3A%20under%20consideration%22
hotlist: error messageshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22hotlist%3A%20error%20messages%22
BacklogNo due datehttps://github.com/angular/angular/milestone/82
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.