Skip to content

Commit 17c6852

Browse files
authored
refactor(material/autocomplete): work around an internal issue (#32458)
Adds a workaround for an error that an internal caught in their production logging.
1 parent 4cc5880 commit 17c6852

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/material/autocomplete/autocomplete-trigger.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,15 @@ export class MatAutocompleteTrigger
767767
}
768768

769769
private _attachOverlay(valueOnAttach: string): void {
770-
if (!this.autocomplete && (typeof ngDevMode === 'undefined' || ngDevMode)) {
771-
throw getMatAutocompleteMissingPanelError();
770+
if (!this.autocomplete) {
771+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
772+
throw getMatAutocompleteMissingPanelError();
773+
} else {
774+
// This shouldn't happen only in production mode, but some internal teams have
775+
// observed it in their production logging. Return since the rest of the function
776+
// assumes that the autocomplete is defined.
777+
return;
778+
}
772779
}
773780

774781
let overlayRef = this._overlayRef;

0 commit comments

Comments
 (0)