Skip to content

fix(platform-browser): avoid circular DI error in async renderer#59271

Closed
josephperrott wants to merge 1 commit intoangular:19.0.xfrom
josephperrott:patch-for-59256
Closed

fix(platform-browser): avoid circular DI error in async renderer#59271
josephperrott wants to merge 1 commit intoangular:19.0.xfrom
josephperrott:patch-for-59256

Conversation

@josephperrott
Copy link
Copy Markdown
Member

Patch version of #59256

In angular/components#30179 the CDK overlay started depending on the `Renderer2Factory`. Since the overlay is used in the `MatSnackbar` which is commonly used in error handlers, `Overlay` can end up being injected as a part of the app initialization. Because `AsyncAnimationRendererFactory` depends on the `ChangeDetectionScheduler`, it may cause a circular dependency.

These changes inject the `ChangeDetectionScheduler` lazily to avoid the error.

Note: this will also be resolved by angular#58984, but I decided to send it out, because:
1. angular#58984 seems to be stuck on some internal cleanup.
2. The `AsyncAnimationRendererFactory` doesn't need the `scheduler` eagerly anyway so the change is fairly safe.

Fixes angular#59255.
@josephperrott josephperrott added action: merge The PR is ready for merge by the caretaker area: animations target: patch This PR is targeted for the next patch release labels Dec 20, 2024
@ngbot ngbot bot added this to the Backlog milestone Dec 20, 2024
@josephperrott
Copy link
Copy Markdown
Member Author

This PR was merged into the repository by commit dbb8980.

The changes were merged into the following branches: 19.0.x

josephperrott pushed a commit that referenced this pull request Dec 21, 2024
)

In angular/components#30179 the CDK overlay started depending on the `Renderer2Factory`. Since the overlay is used in the `MatSnackbar` which is commonly used in error handlers, `Overlay` can end up being injected as a part of the app initialization. Because `AsyncAnimationRendererFactory` depends on the `ChangeDetectionScheduler`, it may cause a circular dependency.

These changes inject the `ChangeDetectionScheduler` lazily to avoid the error.

Note: this will also be resolved by #58984, but I decided to send it out, because:
1. #58984 seems to be stuck on some internal cleanup.
2. The `AsyncAnimationRendererFactory` doesn't need the `scheduler` eagerly anyway so the change is fairly safe.

Fixes #59255.

PR Close #59271
@josephperrott josephperrott deleted the patch-for-59256 branch December 21, 2024 18:28
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: animations target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants