Skip to content

Commit 6024811

Browse files
committed
fix(material-experimental/mdc-progress-bar): check observer function (#21986)
* fix(material-experimental/mdc-progress-bar): check observer function * fix(material-experimental/mdc-progress-bar): use typeof (cherry picked from commit cfd3bc8)
1 parent c0149eb commit 6024811

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/material-experimental/mdc-progress-bar/progress-bar.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,14 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie
102102

103103
if (resizeObserverConstructor) {
104104
const observer = new resizeObserverConstructor(callback);
105-
observer.observe(this._rootElement);
106-
return observer;
105+
106+
// Internal client users found production errors where `observe` was not a function
107+
// on the constructed `observer`. This should not happen, but adding this check for this
108+
// edge case.
109+
if (typeof observer.observe === 'function') {
110+
observer.observe(this._rootElement);
111+
return observer;
112+
}
107113
}
108114

109115
return null;

0 commit comments

Comments
 (0)