You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I managed to draw a Yandex map using react-leaflet, but after switching to a different route, an error occurs in the Yandex plugin. During debugging, it turned out that the destroy () event occurs earlier than this._container.remove (), and the other component is not rendered, because container no longer exists
_destroy: function (e) {
if (!this._map || this._map === e.target) {
if (this._yandex) {
this._yandex.destroy();
delete this._yandex;
}
delete this._container;
}
},
_setEvents: function (map) {
var events = {
move: this._update
};
if (this._zoomAnimated) {
events.zoomanim = this._animateZoom;
events.zoomend = this._animateZoomEnd;
}
map.on(events, this);
this.once('remove', function () {
map.off(events, this);
this._container.remove(); // we do not call this until api is initialized (ymaps API expects DOM element)
}, this);
},
Ошибка
The text was updated successfully, but these errors were encountered:
Hi, I managed to draw a Yandex map using react-leaflet, but after switching to a different route, an error occurs in the Yandex plugin. During debugging, it turned out that the destroy () event occurs earlier than this._container.remove (), and the other component is not rendered, because container no longer exists
MapPage.tsx
<MapLeaflet center={ [55.7558, 37.6173]} zoom={13} style={{width: '800px', height: '800px'}}>
<LayersControlReact.BaseLayer name="Yandex Traffic" checked={true}>
</LayersControlReact.BaseLayer>
Yandex.js
_destroy: function (e) {
if (!this._map || this._map === e.target) {
if (this._yandex) {
this._yandex.destroy();
delete this._yandex;
}
delete this._container;
}
},
_setEvents: function (map) {
var events = {
move: this._update
};
if (this._zoomAnimated) {
events.zoomanim = this._animateZoom;
events.zoomend = this._animateZoomEnd;
}
map.on(events, this);
this.once('remove', function () {
map.off(events, this);
this._container.remove(); // we do not call this until api is initialized (ymaps API expects DOM element)
}, this);
},
Ошибка
The text was updated successfully, but these errors were encountered: