Skip to content

Commit 28e680c

Browse files
devversionjelbourn
authored andcommitted
fix(google-maps): avoid runtime error on server
The google-maps `MapInfoWindow` component currently throws on the server because on `ngOnDestroy`, the `close()` method is called. This method expects an instance of a Google Maps `InfoWindow`. These cannot be created on the server.
1 parent ce2ede3 commit 28e680c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/google-maps/map-info-window/map-info-window.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,12 @@ export class MapInfoWindow implements OnInit, OnDestroy {
122122
this._eventManager.destroy();
123123
this._destroy.next();
124124
this._destroy.complete();
125-
this.close();
125+
126+
// If no info window has been created on the server, we do not try closing it.
127+
// On the server, an info window cannot be created and this would cause errors.
128+
if (this.infoWindow) {
129+
this.close();
130+
}
126131
}
127132

128133
/**

0 commit comments

Comments
 (0)