Documentation Feedback
Problem
Documentation examples need Eager change detection and the StackBlitz template needs to provide Zone.js change detection.
Background
I found two related issues when trying to figure out why the "Table retrieving data through HTTP" example was not rendering data and not quitting it's loading spinner:
I gave more detailed notes on this trial and error explanation on Reddit, when someone said they had issues with tables not rendering data: reddit.com/r/angular/comments/1udhis7/comment/othat1k
Proposed Immediate Solution
edit: see my first comment about how I made one PR for zone and another PR for converting one component type to Eager. As well as a temp branch for this issue's reference of both approaches combined on the Table HTTP example.
Most if not all documentation examples I have seen relied on what is now Eager change detection, and on Zone.js. But any examples I have seen were not opted into Eager CD strategy and the StackBlitz starter does not provide provideZoneChangeDetection(). Edit: I admit I was a bit harsh with this broad generalization as I am going through more history while making things compatible. But I still maintain that there is enough exceptions that I am still going through everything 1 by 1 making things compatible, and I thought me opening with updating everything needed was a bit much. Plenty already were built with zoneless/OnPush or had recent updates, but there is enough exceptions to this.
Without fundamentally making all docs examples zoneless and default OnPush ready, two things need to happen
provideZoneChangeDetection() needs to be provided in the StackBlitz template
- Example files all need
changeDetection: ChangeDetectionStrategy.Eager
And if possible, backport this to v21 docs
Proposed Long Term Solution
Convert documentation examples going forward into the new default change detection and zoneless defaults, dropping the providing of Eager and Zone.
Links
Affected documentation page
https://material.angular.dev/components/categories
Documentation Feedback
Problem
Documentation examples need
Eagerchange detection and the StackBlitz template needs to provide Zone.js change detection.Background
I found two related issues when trying to figure out why the "Table retrieving data through HTTP" example was not rendering data and not quitting it's loading spinner:
I gave more detailed notes on this trial and error explanation on Reddit, when someone said they had issues with tables not rendering data: reddit.com/r/angular/comments/1udhis7/comment/othat1k
Proposed Immediate Solution
edit: see my first comment about how I made one PR for zone and another PR for converting one component type to Eager. As well as a temp branch for this issue's reference of both approaches combined on the Table HTTP example.
Most if not all documentation examples I have seen relied on what is now
Eagerchange detection, and on Zone.js. But any examples I have seen were not opted intoEagerCD strategy and the StackBlitz starter does not provideprovideZoneChangeDetection(). Edit: I admit I was a bit harsh with this broad generalization as I am going through more history while making things compatible. But I still maintain that there is enough exceptions that I am still going through everything 1 by 1 making things compatible, and I thought me opening with updating everything needed was a bit much. Plenty already were built with zoneless/OnPush or had recent updates, but there is enough exceptions to this.Without fundamentally making all docs examples zoneless and default OnPush ready, two things need to happen
provideZoneChangeDetection()needs to be provided in the StackBlitz templatechangeDetection: ChangeDetectionStrategy.EagerAnd if possible, backport this to v21 docs
Proposed Long Term Solution
Convert documentation examples going forward into the new default change detection and zoneless defaults, dropping the providing of Eager and Zone.
Links
RuntimeError: NG0100: ExpressionChangedAfterItHasBeenCheckedErrorin the StackBlitz.Eager+ Zone.js: https://stackblitz.com/edit/upsjm4jr?file=src%2Fexample%2Ftable-http-example.tsAffected documentation page
https://material.angular.dev/components/categories