Skip to content

Commit

Permalink
fix(google-maps): avoid runtime error on server
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
devversion authored and jelbourn committed Apr 23, 2020
1 parent 5a71ccc commit 8f36604
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/google-maps/map-info-window/map-info-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,12 @@ export class MapInfoWindow implements OnInit, OnDestroy {
this._eventManager.destroy();
this._destroy.next();
this._destroy.complete();
this.close();

// If no info window has been created on the server, we do not try closing it.
// On the server, an info window cannot be created and this would cause errors.
if (this.infoWindow) {
this.close();
}
}

/**
Expand Down

0 comments on commit 8f36604

Please sign in to comment.