8000 feat(core): Expose `Injector.destroy` on `Injector` created with … by JeanMeche · Pull Request #60054 · angular/angular · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(core): Expose Injector.destroy on Injector created with … #60054

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

Closed
wants to merge 1 commit into from

Conversation

JeanMeche
Copy link
Member

Injector.create

There is no implementation change, this only expose destroy in a case where the injector can be owned in userland.

@pullapprove pullapprove bot requested a review from mmalerba February 21, 2025 16:07
@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Feb 21, 2025
@ngbot ngbot bot added this to the Backlog milestone Feb 21, 2025
@JeanMeche JeanMeche force-pushed the injector-create-destroy branch 2 times, most recently from 3c88a3a to f1cf742 Compare February 21, 2025 16:25
@pullapprove pullapprove bot requested review from alxhub, kirjs and mmalerba February 21, 2025 22:56
@JeanMeche JeanMeche force-pushed the injector-create-destroy branch 3 times, most recently from 2c4e484 to 77bd499 Compare February 22, 2025 11:13
@JeanMeche JeanMeche force-pushed the injector-create-destroy branch from 77bd499 to 27d6098 Compare February 22, 2025 23:24
@JeanMeche JeanMeche force-pushed the injector-create-destroy branch from 27d6098 to d4bd01b Compare February 22, 2025 23:28
@pullapprove pullapprove bot requested a review from kirjs February 24, 2025 17:05
Copy link
Contributor
@kirjs kirjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed for: Public-api

@pullapprove pullapprove bot requested a review from kirjs February 24, 2025 18:19
Copy link
Contributor
@kirjs kirjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed for: Public-api

@pullapprove pullapprove bot requested a review from kirjs February 24, 2025 18:19
Copy link
Contributor
@kirjs kirjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-for: public-api

@Harpush
Copy link
Harpush commented Feb 24, 2025

@JeanMeche what's the benefit of this vs create environment injector now? When to use each?

@JeanMeche
Copy link
Member Author
JeanMeche commented Feb 24, 2025

createEnvironmentInjector requires an EnvironmentInjector as parent. Which this change you could tie yourself to a NodeInjector (to the life of a component).

@Harpush
Copy link
Harpush commented Feb 24, 2025

createEnvironmentInjector requires an EnvironmentInjector as parent. Which this change you could tie yourself to a NodeInjector (to the life of a component).

So I could create a function that creates an injector that is destroyed automatically with the node injector without destroy ref handling?

@JeanMeche
Copy link
Member Author

Here is an example : https://stackblitz.com/edit/angular-factory-di?file=src%2Fmain.ts (not suggesting that you should exactly do that, but you can).

@Harpush
Copy link
Harpush commented Feb 24, 2025

Here is an example : https://stackblitz.com/edit/angular-factory-di?file=src%2Fmain.ts (not suggesting that you should exactly do that, but you can).

Why do you need destroy ref though? Won't it die with the injector it was based on? So if called in component it will die with the component injector?

@JeanMeche
Copy link
Member Author

Injectors don't have references to their child injectors.

…ector.create`

There is no implementation change, this only expose `destroy` in a case where the injector can be owned in userland.
@JeanMeche JeanMeche force-pushed the injector-create-destroy branch from d4bd01b to 2cd0426 Compare February 26, 2025 16:28
@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Feb 26, 2025
@JeanMeche JeanMeche added the target: minor This PR is targeted for the next minor release label Feb 26, 2025
@JeanMeche JeanMeche changed the title refactor(core): Expose Injector.destroy on Injector created with … feat(core): Expose Injector.destroy on Injector created with … Feb 26, 2025
Copy link
Contributor
@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-for: public-api

@JeanMeche JeanMeche added the action: merge The PR is ready for merge by the caretaker label Feb 26, 2025
@mmalerba
Copy link
Contributor

This PR was merged into the repository by commit 4812215.

The changes were merged into the following branches: main

@mmalerba mmalerba closed this in 4812215 Feb 27, 2025
@JeanMeche JeanMeche deleted the injector-create-destroy branch March 7, 2025 16:35
@angular-automatic-lock-bot
Copy link

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 Apr 7, 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: core Issues related to the framework runtime detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0