diff --git a/src/google_map.js b/src/google_map.js index c47613e..c4f365a 100644 --- a/src/google_map.js +++ b/src/google_map.js @@ -1,7 +1,7 @@ /* eslint-disable import/no-extraneous-dependencies, react/forbid-prop-types, no-console, no-undef */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import ReactDOM from 'react-dom'; +import ReactDOM, { flushSync } from 'react-dom'; // helpers import GoogleMapMap from './google_map_map'; @@ -703,7 +703,9 @@ class GoogleMap extends Component { this_._onChildMouseMove(); if (this_.markersDispatcher_) { - this_.markersDispatcher_.emit('kON_CHANGE'); + flushSync(() => { + this_.markersDispatcher_.emit('kON_CHANGE'); + }) if (this_.fireMouseEventOnIdle_) { this_.markersDispatcher_.emit('kON_MOUSE_POSITION_CHANGE'); } diff --git a/src/google_map_markers.js b/src/google_map_markers.js index e2fbb66..b672702 100644 --- a/src/google_map_markers.js +++ b/src/google_map_markers.js @@ -93,7 +93,7 @@ export default class GoogleMapMarkers extends Component { this.props.dispatcher.removeListener('kON_CLICK', this._onChildClick); this.props.dispatcher.removeListener('kON_MDOWN', this._onChildMouseDown); - this.dimensionsCache_ = null; + this.dimensionsCache_ = {}; } _getState = () => ({