Skip to content

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

Closed
crisbeto wants to merge 1 commit intoangular:mainfrom
crisbeto:55466/fallback-content-multiple
Closed

fix(core): resolve error for multiple component instances that use fallback content#55478
crisbeto wants to merge 1 commit intoangular:mainfrom
crisbeto:55466/fallback-content-multiple

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 requested a review from AndrewKushnir April 24, 2024 18:34
@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
@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 May 26, 2024
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 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