Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

fix(feature-targeting): prevent accidental nesting of mdc-feature-targets mixin #4281

Merged
merged 3 commits into from
Jan 23, 2019

Conversation

mmalerba
Copy link
Collaborator

Nesting this mixin could lead to unexpected results. (e.g. the following property would not get emitted if the color styles were requested)

@include mdc-feature-targets($feat-structure) {
  @include mdc-feature-targets($feat-color) {
    color: red;
  }
}

This PR makes the above pattern an error by using a global variable to track when we're inside the mixin and raise an error if the mixin is included again in that context.

packages/mdc-feature-targeting/_mixins.scss Outdated Show resolved Hide resolved
Copy link
Contributor

@kfranqueiro kfranqueiro left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! I was definitely wary of this potential mistake, so throwing an error on it will be super useful.

@abhiomkar abhiomkar merged commit 3405bc4 into material-components:master Jan 23, 2019
@jamesmfriedman jamesmfriedman mentioned this pull request Feb 5, 2019
24 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants