Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

refactor(core): implement ɵɵforeignComponent instruction#68787

Merged
atscott merged 4 commits into
angular:mainangular/angular:mainfrom
leonsenft:foreign-component-instruction-implleonsenft/angular:foreign-component-instruction-implCopy head branch name to clipboard
Jun 3, 2026
Merged

refactor(core): implement ɵɵforeignComponent instruction#68787
atscott merged 4 commits into
angular:mainangular/angular:mainfrom
leonsenft:foreign-component-instruction-implleonsenft/angular:foreign-component-instruction-implCopy head branch name to clipboard

Conversation

@leonsenft

@leonsenft leonsenft commented May 18, 2026

Copy link
Copy Markdown
Contributor

Implement the ɵɵforeignComponent instruction to render foreign components (components from other frameworks) inside Angular templates. The instruction creates a host LContainer, instantiates a foreign view, executes the foreign component's RENDER function, inserts the returned native DOM nodes, and registers the disposal hook.

Add unit tests to verify element rendering, property passing, and disposal on destruction.

@angular-robot angular-robot Bot added area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime labels May 18, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 18, 2026
@leonsenft leonsenft added target: minor This PR is targeted for the next minor release and removed area: compiler Issues related to `ngc`, Angular's template compiler labels May 18, 2026
@leonsenft leonsenft force-pushed the foreign-component-instruction-impl branch from d90f975 to 8e7fbee Compare May 20, 2026 18:27
@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label May 20, 2026
@leonsenft leonsenft marked this pull request as ready for review May 20, 2026 18:29
@leonsenft leonsenft force-pushed the foreign-component-instruction-impl branch 3 times, most recently from b8eca2a to a4915d8 Compare May 28, 2026 17:27
Comment thread packages/core/src/metadata/directives.ts
Comment thread packages/core/src/render3/instructions/foreign_component.ts
@leonsenft leonsenft requested a review from atscott May 28, 2026 21:59
Comment thread packages/core/src/interface/foreign_component.ts Outdated
Comment thread packages/core/src/render3/instructions/foreign_component.ts Outdated
Comment thread packages/core/test/render3/foreign_component_spec.ts
Comment thread packages/core/src/render3/instructions/foreign_component.ts Outdated
@leonsenft leonsenft added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels May 29, 2026
@ngbot

ngbot Bot commented May 29, 2026

Copy link
Copy Markdown

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "google-internal-tests" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@leonsenft

Copy link
Copy Markdown
Contributor Author

note for caretaker: TAP failures are preexisting.

@leonsenft leonsenft added action: merge The PR is ready for merge by the caretaker and removed action: merge The PR is ready for merge by the caretaker labels May 29, 2026
@josephperrott josephperrott added target: minor This PR is targeted for the next minor release and removed target: minor This PR is targeted for the next minor release labels Jun 1, 2026
Add descriptive text to foreign view head and tail comments in dev mode to
assist in debugging.
leonsenft added 3 commits June 1, 2026 08:51
Implement the `ɵɵforeignComponent` instruction to render foreign components
(components from other frameworks) inside Angular templates. The instruction
creates a host LContainer, instantiates a foreign view, executes the foreign
component's RENDER function, inserts the returned native DOM nodes, and
registers the disposal hook.

Add unit tests to verify element rendering, property passing, dependency
injection, and disposal on destruction.
…nt props

Avoid triggering the `interpolated_signal_not_invoked` diagnostic when
a signal is passed directly as a property binding to a foreign
component. Foreign components may accept signals directly, so they
should not be flagged as uninvoked in this context.

To support testing this, the typecheck testing infrastructure was
updated to allow defining mock foreign components in the test setup.
Previously, the `ɵɵforeignComponent` instruction set the `currentTNode`
state during the first template creation pass (via `getOrCreateTNode`),
but failed to do so on subsequent instantiations when the `TNode` was
accessed from cache.

This resulted in the global `currentTNode` state remaining unchanged from
the previous instruction. When closing a parent element (e.g., via
`ɵɵelementEnd`), this mismatched state caused assertion failures
because the framework attempted to close the wrong parent node.
This change fixes the issue by calling `setCurrentTNode(tNode, false)`
when the foreign component's `TNode` is retrieved from the cache.
@leonsenft leonsenft force-pushed the foreign-component-instruction-impl branch from 12c04bc to d1c515d Compare June 1, 2026 15:52
@leonsenft leonsenft removed the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Jun 2, 2026
@leonsenft

Copy link
Copy Markdown
Contributor Author

Removing caretaker note since TAP is now green.

@atscott atscott merged commit 0c07356 into angular:main Jun 3, 2026
22 checks passed
@atscott

atscott commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

@leonsenft leonsenft deleted the foreign-component-instruction-impl branch June 3, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime 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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.