angular / angular

Deliver web apps with confidence 🚀
https://angular.dev
MIT License
94.71k stars 24.68k forks source link

Revert "fix(core): render hooks should not specifically run outside t… #55624

Closed atscott closed 2 weeks ago

atscott commented 2 weeks ago

…he Angular zone (#55399)"

This reverts commit 7e89753eeff24f52d39fef92600293bf1700cd1b.

Running render hooks inside the zone is specifically problematic for afterRender hooks. If the callback has async task, it would cause an infinite change detection. In addition, updating state in render hooks is generally discourages and certainly should update state in a way that notifies Angular of the change (either via signal or with markForCheck) rather than relying on ZoneJS to pick it up (which would only work if the change is done inside an async task).

atscott commented 2 weeks ago

merge assistance: g3 failures are unrelated

AndrewKushnir commented 2 weeks ago

This PR was merged into the repository by commit 8cabb7a85d8b759d8863d31e72abc9b73ee44453.