Skip to content

Commit 8f36604

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 5a71ccc commit 8f36604

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
@@ -114,7 +114,12 @@ export class MapInfoWindow implements OnInit, OnDestroy {
114114
this._eventManager.destroy();
115115
this._destroy.next();
116116
this._destroy.complete();
117-
this.close();
117+
118+
// If no info window has been created on the server, we do not try closing it.
119+
// On the server, an info window cannot be created and this would cause errors.
120+
if (this.infoWindow) {
121+
this.close();
122+
}
118123
}
119124

120125
/**

0 commit comments

Comments
 (0)