Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

afterNextRender documentation lacks details and limitations #55870

Open
kemsky opened this issue May 18, 2024 · 0 comments
Open

afterNextRender documentation lacks details and limitations #55870

kemsky opened this issue May 18, 2024 · 0 comments
Labels
area: core Issues related to the framework runtime area: docs Related to the documentation
Milestone

Comments

@kemsky
Copy link

kemsky commented May 18, 2024

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

We are using MessageChannel.portX.postMessage and Promise.resolve().then to schedule tasks and micro-tasks. It allows to schedule code to execute after render (at least it used to work) and after certain callbacks. Also, our code is aware of zones, so it will run angular tasks in angular zone and root tasks in root zone.

I've tried to replace MessageChannel hack with afterNextRender which in theory should be a drop-in replacement but it quickly became obvious that it will not work because it requires injection context or explicitly provided injector which is extremely inconvenient and leads to errors that are difficult to reason about.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

NG0203 - missing context, then other non-angular errors due to unexpected context because I provided app module injector.

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.1.2
Node: 20.13.1
Package Manager: yarn 3.5.1
OS: linux x64

Angular: 17.1.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... elements, forms, language-service, material
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1701.2
@angular-devkit/build-angular   17.1.2
@angular-devkit/core            17.1.2
@angular-devkit/schematics      17.1.2
@schematics/angular             17.1.2
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.3

Anything else?

No response

@atscott atscott added area: core Issues related to the framework runtime area: docs Related to the documentation labels May 21, 2024
@ngbot ngbot bot added this to the needsTriage milestone May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues related to the framework runtime area: docs Related to the documentation
Projects
None yet
Development

No branches or pull requests

2 participants