mirror of
https://github.com/google-map-react/google-map-react.git
synced 2025-12-08 18:26:32 +00:00
Fix: React 18 markers (#1224)
* disable batching for _onChange listener * correctly reset cache * move flushsync out of lifecycle method
This commit is contained in:
parent
743aaa3b4c
commit
5776154425
@ -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');
|
||||
}
|
||||
|
||||
@ -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 = () => ({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user