Skip to content

fix(tabs): not picking up indirect descendant tabs in ivy #17346

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

Merged
merged 1 commit into from
Oct 15, 2019

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Oct 9, 2019

In ViewEngine ContentChildren would pick up indirect descendant items, as long as another directive wasn't matched along the way. This allowed for tabs to be wrapped inside something like an ng-container. With Ivy ContentChildren is a little more strict and it only works on direct descendants.

These changes turn on descendants so that we continue supporting the existing use cases from ViewEngine. Note that it needs a bit of extra logic in order to ensure that nested tab groups continue to work as expected.

Fixes #17336.

@crisbeto crisbeto added P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful target: patch This PR is targeted for the next patch release labels Oct 9, 2019
@crisbeto crisbeto requested a review from andrewseguin as a code owner October 9, 2019 20:44
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 9, 2019
@@ -243,11 +248,26 @@ export abstract class _MatTabGroupBase extends _MatTabGroupMixinBase implements
}
}

this._subscribeToTabLabels();
Copy link
Member Author

@crisbeto crisbeto Oct 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this call because I noticed that there's another one just like it a few lines above. It seems like an issue when resolving merge conflicts.

@crisbeto crisbeto force-pushed the 17336/tabs-descendants-ivy branch from e90b623 to 1e2a8fc Compare October 10, 2019 15:56
Copy link
Contributor

@Splaktar Splaktar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

</mat-tab-group>
`,
})
class TabGroupWithIndirectDescendantTabs {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all duplicated from what's in material/. Do we have a reason for choosing this approach?
Was it too much work or is there a blocker to trying to export something from material/ tests that could be re-used in the material-experimental/mdc-x tests?

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

In ViewEngine `ContentChildren` would pick up indirect descendant items, as long as another directive wasn't matched along the way. This allowed for tabs to be wrapped inside something like an `ng-container`. With Ivy `ContentChildren` is a little more strict and it only works on direct descendants.

These changes turn on `descendants` so that we continue supporting the existing use cases from ViewEngine. Note that it needs a bit of extra logic in order to ensure that nested tab groups continue to work as expected.

Fixes angular#17336.
@crisbeto crisbeto force-pushed the 17336/tabs-descendants-ivy branch from 1e2a8fc to ef1c63f Compare October 12, 2019 08:20
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Oct 12, 2019
@mmalerba mmalerba merged commit ed0067e into angular:master Oct 15, 2019
@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 Nov 15, 2019
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 cla: yes PR author has agreed to Google's Contributor License Agreement P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mat-tab inside ng-container failed to display in ivy
6 participants