refactor(core): defer foreign component rendering to post-update pass - #70388
Open
leonsenft wants to merge 1 commit into
Open
refactor(core): defer foreign component rendering to post-update pass#70388leonsenft wants to merge 1 commit into
leonsenft wants to merge 1 commit into
Conversation
leonsenft
force-pushed
the
defer_foreign_component_render
branch
3 times, most recently
from
August 25, 2026 21:30
1a7dfcb to
ffaf0a5
Compare
Foreign components imported via foreignImports and created by the ɵɵforeignComponent instruction were previously rendered eagerly in the creation phase (rf & 1) of the template. This restricted which properties could be passed to foreign component props, as parent-bound inputs (@input(), input(), input.required()), properties initialized in ngOnInit(), and view queries (viewChild(), @ViewChild()) were not yet initialized at creation time. This change defers foreign component rendering to the end of the view update pass: - Update ɵɵforeignComponent in core to schedule component rendering via EFFECTS_TO_SCHEDULE at the end of the update pass (refreshView), executed within untracked() to prevent reactive context leakage. - Update ɵɵforeignComponent to strictly accept props as a factory function (() => props) or null. - Update the compiler template pipeline to wrap foreign component props in an arrow function closure (() => ({ ... })). - Hoist creation-time foreign content projection instructions (ɵɵforeignContent, ɵɵforeignContentFn) into creation-phase variable declarations before ɵɵforeignComponent so creation-time context is captured safely. - Immediately refresh embedded views created for projected foreign content so control flow and child bindings evaluate on initial render.
leonsenft
force-pushed
the
defer_foreign_component_render
branch
from
August 25, 2026 21:55
ffaf0a5 to
69b1369
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.
Foreign components imported via
foreignImportsand created by theɵɵforeignComponentinstruction were previously rendered eagerly in the creation phase (rf & 1) of the template. This restricted which properties could be passed to foreign component props, as parent-bound inputs (@Input(),input(),input.required()), properties initialized inngOnInit(), and view queries (viewChild(),@ViewChild()) were not yet initialized at creation time.This change defers foreign component rendering to the end of the view update pass:
ɵɵforeignComponentin core to schedule component rendering viaEFFECTS_TO_SCHEDULEat the end of the update pass (refreshView), executed withinuntracked()to prevent reactive context leakage.ɵɵforeignComponentto strictly accept props as a factory function ((() => props) | null).() => ({ ... })).ɵɵforeignContent,ɵɵforeignContentFn) into creation-phase variable declarations beforeɵɵforeignComponentso creation-time context is captured safely.