Skip to content
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

fix(core): resolve error for multiple component instances that use fallback content #55478

Closed

Conversation

crisbeto
Copy link
Member

Currently fallback content for ng-content gets declared and rendered out in one go. This breaks down if multiple instances of the same component are used where one doesn't render the fallback content while the other one does, because the TNode for the content has to be created during the first creation pass.

These changes resolve the issue by always declaring the template, but only rendering it if the slot is empty.

Fixes #55466.

@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: major This PR is targeted for the next major release labels Apr 23, 2024
@ngbot ngbot bot modified the milestone: Backlog Apr 23, 2024
@crisbeto crisbeto force-pushed the 55466/fallback-content-multiple branch from dda6daf to 221ab52 Compare April 24, 2024 10:50
@crisbeto crisbeto marked this pull request as ready for review April 24, 2024 18:35
…llback content

Currently fallback content for `ng-content` gets declared and rendered out in one go. This breaks down if multiple instances of the same component are used where one doesn't render the fallback content while the other one does, because the `TNode` for the content has to be created during the first creation pass.

These changes resolve the issue by always _declaring_ the template, but only rendering it if the slot is empty.

Fixes angular#55466.
@crisbeto crisbeto force-pushed the 55466/fallback-content-multiple branch from 221ab52 to d1c63d4 Compare April 24, 2024 19:17
@crisbeto crisbeto 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 and removed action: review The PR is still awaiting reviews from at least one requested reviewer merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Apr 24, 2024
@AndrewKushnir AndrewKushnir added target: rc This PR is targeted for the next release-candidate and removed target: major This PR is targeted for the next major release labels Apr 25, 2024
@AndrewKushnir
Copy link
Contributor

This PR was merged into the repository by commit 97eea8d.

AndrewKushnir pushed a commit that referenced this pull request Apr 25, 2024
…llback content (#55478)

Currently fallback content for `ng-content` gets declared and rendered out in one go. This breaks down if multiple instances of the same component are used where one doesn't render the fallback content while the other one does, because the `TNode` for the content has to be created during the first creation pass.

These changes resolve the issue by always _declaring_ the template, but only rendering it if the slot is empty.

Fixes #55466.

PR Close #55478
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: core Issues related to the framework runtime target: rc This PR is targeted for the next release-candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fallback content throws with multiple components v18.x
2 participants