Skip to content

Commit 20cef60

Browse files
committed
fixup! refactor(material/core): generalize lazy ripple logic
1 parent 807fbc6 commit 20cef60

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/material/button/button-base.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export class MatButtonBase
116116
}
117117
override set disableRipple(value: any) {
118118
this._disableRipple = coerceBooleanProperty(value);
119+
this._updateRippleDisabled();
119120
}
120121
private _disableRipple: boolean = false;
121122

@@ -124,6 +125,7 @@ export class MatButtonBase
124125
}
125126
override set disabled(value: any) {
126127
this._disabled = coerceBooleanProperty(value);
128+
this._updateRippleDisabled();
127129
}
128130
private _disabled: boolean = false;
129131

@@ -133,10 +135,10 @@ export class MatButtonBase
133135
* @breaking-change 17.0.0
134136
*/
135137
get ripple(): MatRipple {
136-
return this._rippleLoader.getRipple(this._elementRef.nativeElement)!;
138+
return this._rippleLoader?.getRipple(this._elementRef.nativeElement)!;
137139
}
138140
set ripple(v: MatRipple) {
139-
this._rippleLoader.attachRipple(this._elementRef.nativeElement, v);
141+
this._rippleLoader?.attachRipple(this._elementRef.nativeElement, v);
140142
}
141143

142144
constructor(
@@ -147,7 +149,7 @@ export class MatButtonBase
147149
) {
148150
super(elementRef);
149151

150-
this._rippleLoader.configureRipple(this._elementRef.nativeElement, {
152+
this._rippleLoader?.configureRipple(this._elementRef.nativeElement, {
151153
className: 'mat-mdc-button-ripple',
152154
});
153155

@@ -187,7 +189,7 @@ export class MatButtonBase
187189
}
188190

189191
private _updateRippleDisabled(): void {
190-
this._rippleLoader.setDisabled(
192+
this._rippleLoader?.setDisabled(
191193
this._elementRef.nativeElement,
192194
this.disableRipple || this.disabled,
193195
);

0 commit comments

Comments
 (0)