Skip to content

Commit

Permalink
refactor(expansion): avoid unnecessary spacing check (#17693)
Browse files Browse the repository at this point in the history
The check where `expanded` equals to `false`, and where the value of
the `_getExpandedState` method is compared to `default` will always
evaluate to `false`. This is because the method return value does not
have any overlap with `default`. Hence the check is unnecessary.

This seems to be a leftover from f9bd5d4.
  • Loading branch information
devversion authored and jelbourn committed Nov 26, 2019
1 parent 25c79cd commit b44291d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/material/expansion/expansion-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,7 @@ export class MatExpansionPanel extends CdkAccordionItem implements AfterContentI
/** Determines whether the expansion panel should have spacing between it and its siblings. */
_hasSpacing(): boolean {
if (this.accordion) {
// We don't need to subscribe to the `stateChanges` of the parent accordion because each time
// the [displayMode] input changes, the change detection will also cover the host bindings
// of this expansion panel.
return (this.expanded ? this.accordion.displayMode : this._getExpandedState()) === 'default';
return this.expanded && this.accordion.displayMode === 'default';
}
return false;
}
Expand Down

0 comments on commit b44291d

Please sign in to comment.