refactor(core): add context support for foreign components#69502
Draft
leonsenft wants to merge 1 commit into
Draft
refactor(core): add context support for foreign components#69502leonsenft wants to merge 1 commit into
leonsenft wants to merge 1 commit into
Conversation
f19dd77 to
7b37e64
Compare
Enable foreign components to receive and propagate contextual data across framework boundaries. Previously, foreign render functions only accepted component properties, and foreign content projection instructions (`ɵɵforeignContent` / `ɵɵforeignContentFn`) did not provide any mechanism to expose foreign framework context to projected Angular embedded views. With this change: - Update `ForeignRenderFn` and `ForeignComponent` interfaces to accept an optional context parameter and an optional `GET_CONTEXT` symbol method. - Introduce `FOREIGN_CONTEXT` injection token and `provideForeignRootContext` helper to configure root context in Angular's DI hierarchy. - Update `ɵɵforeignComponent` instruction to resolve `FOREIGN_CONTEXT` from the injection tree and pass it to the foreign component's render function. - Update `ɵɵforeignContent` and `ɵɵforeignContentFn` instructions to accept `foreignComponentConstIndex` and wrap embedded view creation with a `ForeignContextInjector` when `GET_CONTEXT` is present. Furthermore, foreign render functions are no longer run inside an Angular injection context, since it's expected they use the foreign context support directly.
7b37e64 to
3539fba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enable foreign components to receive and propagate contextual data across framework boundaries.
Previously, foreign render functions only accepted component properties, and foreign content projection instructions (
ɵɵforeignContent/ɵɵforeignContentFn) did not provide any mechanism to expose foreign framework context to projected Angular embedded views.With this change:
Update
ForeignRenderFnandForeignComponentinterfaces to accept an optional context parameter and an optionalGET_CONTEXTsymbol method.Introduce
FOREIGN_CONTEXTinjection token andprovideForeignRootContexthelper to configure root context in Angular's DI hierarchy.Update
ɵɵforeignComponentinstruction to resolveFOREIGN_CONTEXTfrom the injection tree and pass it to the foreign component's render function.Update
ɵɵforeignContentandɵɵforeignContentFninstructions to acceptforeignComponentConstIndexand wrap embedded view creation with aForeignContextInjectorwhenGET_CONTEXTis present.Furthermore, foreign render functions are no longer run inside an Angular injection context, since it's expected they use the foreign context support directly.