Skip to content

Commit b311f93

Browse files
committed
refactor(expansion): avoid unnecessary spacing check
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.
1 parent 5f447c1 commit b311f93

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/material/expansion/expansion-panel.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,7 @@ export class MatExpansionPanel extends CdkAccordionItem implements AfterContentI
182182
/** Determines whether the expansion panel should have spacing between it and its siblings. */
183183
_hasSpacing(): boolean {
184184
if (this.accordion) {
185-
// We don't need to subscribe to the `stateChanges` of the parent accordion because each time
186-
// the [displayMode] input changes, the change detection will also cover the host bindings
187-
// of this expansion panel.
188-
return (this.expanded ? this.accordion.displayMode : this._getExpandedState()) === 'default';
185+
return this.expanded && this.accordion.displayMode === 'default';
189186
}
190187
return false;
191188
}

0 commit comments

Comments
 (0)