René's URL Explorer Experiment


Title: Dynamic component detectChanges trigger ngDoCheck but not refresh view · Issue #39524 · angular/angular · GitHub

Open Graph Title: Dynamic component detectChanges trigger ngDoCheck but not refresh view · Issue #39524 · angular/angular

X Title: Dynamic component detectChanges trigger ngDoCheck but not refresh view · Issue #39524 · angular/angular

Description: This is a related issue of #36667. Reproduce live demo is here. https://stackblitz.com/edit/angular-vz1dca?file=src/app/app.module.ts https://stackblitz.com/edit/angular-7h6eer?file=src/app/app.module.ts code is this. import { Co...

Open Graph Description: This is a related issue of #36667. Reproduce live demo is here. https://stackblitz.com/edit/angular-vz1dca?file=src/app/app.module.ts https://stackblitz.com/edit/angular-7h6eer?file=src/app%2...

X Description: This is a related issue of #36667. Reproduce live demo is here. https://stackblitz.com/edit/angular-vz1dca?file=src/app/app.module.ts https://stackblitz.com/edit/angular-7h6eer?file=src/app%2...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Dynamic component detectChanges trigger ngDoCheck but not refresh view","articleBody":"This is a related issue of #36667. \r\nReproduce live demo is here.\r\nhttps://stackblitz.com/edit/angular-vz1dca?file=src%2Fapp%2Fapp.module.ts\r\nhttps://stackblitz.com/edit/angular-7h6eer?file=src%2Fapp%2Fapp.module.ts\r\n\r\ncode is this.\r\n\r\n```\r\nimport {\r\n  Component,\r\n  NgModule,\r\n  ViewContainerRef,\r\n  ComponentFactoryResolver,\r\n  Injector,\r\n  ChangeDetectionStrategy,\r\n  DoCheck\r\n} from \"@angular/core\";\r\nimport { BrowserModule } from \"@angular/platform-browser\";\r\n\r\nimport { timer } from \"rxjs\";\r\n\r\n@Component({\r\n  selector: \"dynamic\",\r\n  template: `\r\n    {{ name }}\r\n  `,\r\n  changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class Dynamic implements DoCheck {\r\n  name = \"initial name\";\r\n\r\n  ngDoCheck() {\r\n    console.log(\"docheck dynamic\");\r\n  }\r\n}\r\n\r\n@Component({\r\n  selector: \"my-app\",\r\n  template: `\r\n    \u003cb>Expected\u003c/b>: \"initial name\" changes to \"changed name\" after 2s\u003cbr />\r\n    \u003cb>Actual\u003c/b>:\u003cbr />\r\n  `,\r\n  changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class AppComponent {\r\n  constructor(\r\n    private _vcRef: ViewContainerRef,\r\n    private _cfr: ComponentFactoryResolver,\r\n    private _injector: Injector\r\n  ) {}\r\n\r\n  ngOnInit() {\r\n    const cmptRef = this._cfr\r\n      .resolveComponentFactory(Dynamic)\r\n      .create(this._injector);\r\n    this._vcRef.insert(cmptRef.hostView);\r\n\r\n    setTimeout(() => {\r\n      cmptRef.instance.name = \"changed name\";\r\n      console.log(\"changing name\");\r\n      cmptRef.changeDetectorRef.detectChanges();\r\n    }, 2000);\r\n  }\r\n}\r\n\r\n@NgModule({\r\n  imports: [BrowserModule],\r\n  declarations: [AppComponent, Dynamic],\r\n  entryComponents: [Dynamic],\r\n  bootstrap: [AppComponent]\r\n})\r\nexport class AppModule {}\r\n\r\n```\r\n\r\nThe reason is for `dynamic component`, there is a host view as a placeholder, the `hooks` are registered on the host view not the component view, when calling `componentRef.changeDetectorRef.detectChanges()`, it will run change detection from root host view, and trigger the `doCheck hook`, but when it really want to refresh child component, since it is a onPush component and not marked dirty, it will not be refreshed. \r\n\r\nI will try to resolve this issue in #39463 too.","author":{"url":"https://github.com/JiaLiPassion","@type":"Person","name":"JiaLiPassion"},"datePublished":"2020-10-31T23:38:48Z","url":"https://github.com/angular/angular/issues/39524"}

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:b9696659-1c30-aac3-4897-76455e50cebf
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD22A:785A9:A7CD1B:D60AD1:6B00F419
html-safe-nonce93680fe0e360500a66e4680e932922c7c348b9b1de97d318c559f9c74c3de225
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjJBOjc4NUE5OkE3Q0QxQjpENjBBRDE6NkIwMEY0MTkiLCJ2aXNpdG9yX2lkIjoiODU3ODk1MDMxNjk5MjA3MTkzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac15f3cff513ff3dd17ade89404b604965ab1b03f679353ebb44c7e0289031e946
hovercard-subject-tagissue:733828302
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/39524/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f31862661604e017afa4f279819d1a6cf769e614e510b80529e1c7ff31094dc4/angular/angular/issues/39524
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f31862661604e017afa4f279819d1a6cf769e614e510b80529e1c7ff31094dc4/angular/angular/issues/39524
og:image:altThis is a related issue of #36667. Reproduce live demo is here. https://stackblitz.com/edit/angular-vz1dca?file=src/app/app.module.ts https://stackblitz.com/edit/angular-7h6eer?file=src/app%2...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameJiaLiPassion
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
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
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/39524#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F39524
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%2F39524
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/39524
Reloadhttps://github.com/angular/angular/issues/39524
Reloadhttps://github.com/angular/angular/issues/39524
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues835 (835)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/39524
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/39524
Dynamic component detectChanges trigger ngDoCheck but not refresh viewhttps://github.com/angular/angular/issues/39524#top
https://github.com/JiaLiPassion
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P3%22
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
Fixit H1'2022https://github.com/angular/angular/milestone/113
https://github.com/JiaLiPassion
JiaLiPassionhttps://github.com/JiaLiPassion
on Oct 31, 2020https://github.com/angular/angular/issues/39524#issue-733828302
#36667https://github.com/angular/angular/issues/36667
https://stackblitz.com/edit/angular-vz1dca?file=src%2Fapp%2Fapp.module.tshttps://stackblitz.com/edit/angular-vz1dca?file=src%2Fapp%2Fapp.module.ts
https://stackblitz.com/edit/angular-7h6eer?file=src%2Fapp%2Fapp.module.tshttps://stackblitz.com/edit/angular-7h6eer?file=src%2Fapp%2Fapp.module.ts
#39463https://github.com/angular/angular/pull/39463
JiaLiPassionhttps://github.com/JiaLiPassion
on Oct 31, 2020https://github.com/angular/angular/issues/39524#event-3944590981
JiaLiPassionhttps://github.com/JiaLiPassion
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
on Oct 31, 2020https://github.com/angular/angular/issues/39524#event-3944591094
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
on Oct 31, 2020https://github.com/angular/angular/issues/39524#event-3944591104
https://github.com/alexzuza
alexzuzahttps://github.com/alexzuza
on Nov 2, 2020https://github.com/angular/angular/issues/39524#issuecomment-720457195
https://stackblitz.com/edit/angular-kbmdjf?file=src%2Fapp%2Fapp.module.tshttps://stackblitz.com/edit/angular-kbmdjf?file=src%2Fapp%2Fapp.module.ts
https://github.com/JiaLiPassion
JiaLiPassionhttps://github.com/JiaLiPassion
on Nov 2, 2020https://github.com/angular/angular/issues/39524#issuecomment-720483975
@alexzuzahttps://github.com/alexzuza
AndrewKushnirhttps://github.com/AndrewKushnir
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P3%22
on Nov 4, 2020https://github.com/angular/angular/issues/39524#event-3958908894
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
Backloghttps://github.com/angular/angular/milestone/82
on Nov 4, 2020https://github.com/angular/angular/issues/39524#event-3958908961
https://github.com/pkozlowski-opensource
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
on Jul 4, 2022https://github.com/angular/angular/issues/39524#issuecomment-1173937144
#46641https://github.com/angular/angular/pull/46641
#46641https://github.com/angular/angular/pull/46641
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jul 4, 2022https://github.com/angular/angular/issues/39524#event-6928907660
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
Backloghttps://github.com/angular/angular/milestone/82
Fixit H1'2022https://github.com/angular/angular/milestone/113
on Jul 4, 2022https://github.com/angular/angular/issues/39524#event-6928929175
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Aug 4, 2022https://github.com/angular/angular/issues/39524#issuecomment-1205457327
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 Aug 4, 2022https://github.com/angular/angular/issues/39524#event-7129335708
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/39524
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/39524
JiaLiPassionhttps://github.com/JiaLiPassion
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P3%22
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
Fixit H1'2022https://github.com/angular/angular/milestone/113
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.