mirror of
https://github.com/google-map-react/google-map-react.git
synced 2025-12-08 18:26:32 +00:00
Add guard to api loaded callback
This commit is contained in:
parent
507d5f3cfd
commit
a9927672ec
@ -131,6 +131,7 @@ export default class GoogleMap extends Component {
|
||||
super(props);
|
||||
this.mounted_ = false;
|
||||
this.initialized_ = false;
|
||||
this.googleApiLoadedCalled_ = false;
|
||||
|
||||
this.map_ = null;
|
||||
this.maps_ = null;
|
||||
@ -404,8 +405,6 @@ export default class GoogleMap extends Component {
|
||||
this.map_ = map;
|
||||
this.maps_ = maps;
|
||||
|
||||
this._onGoogleApiLoaded({map, maps});
|
||||
|
||||
// render in overlay
|
||||
const this_ = this;
|
||||
const overlay = this.overlay_ = assign(new maps.OverlayView(), {
|
||||
@ -462,6 +461,11 @@ export default class GoogleMap extends Component {
|
||||
this_.updateCounter_++;
|
||||
this_._onBoundsChanged(map, maps, !this_.props.debounced);
|
||||
|
||||
if (!this_.googleApiLoadedCalled_) {
|
||||
this_._onGoogleApiLoaded({map, maps});
|
||||
this_.googleApiLoadedCalled_ = true;
|
||||
}
|
||||
|
||||
div.style.left = `${ptxRounded.x}px`;
|
||||
div.style.top = `${ptxRounded.y}px`;
|
||||
if (this_.markersDispatcher_) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user