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

After render app ref tick #52455

Closed
wants to merge 2 commits into from
Closed

Commits on Jan 3, 2024

  1. fix(core): afterRender hooks now only run on ApplicationRef.tick

    The `afterRender` hooks currently run after `ApplicationRef.tick` but
    also run after any call to `ChangeDetectorRef.detectChanges`. This is
    problematic because code which uses `afterRender` cannot expect the
    component it's registered from to be rendered when the callback
    executes. If there is a call to `ChangeDetectorRef.detectChanges` before
    the global change detection, that will cause the hooks to run earlier
    than expected.
    
    This behavior is somewhat of a blocker for the zoneless project. There
    is plenty of application code that do things like `setTimeout(() =>
    doSomethingThatExpectsComponentToBeRendered())`, `NgZone.onStable(() =>
    ...)` or `ApplicationRef.onStable...`. `ApplicationRef.onStable` is a
    should likely work similarly, but all of these are really wanting an API
    that is `afterRender` with the requirement that the hook runs after the
    global render, not an individual CDRef instance.
    
    This change updates the `afterRender` hooks to only run when
    `ApplicationRef.tick` happens.
    
    fixes angular#52429
    fixes angular#53232
    atscott committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    31907e3 View commit details
    Browse the repository at this point in the history

Commits on Jan 5, 2024

  1. Configuration menu
    Copy the full SHA
    a87a3e1 View commit details
    Browse the repository at this point in the history