Comments (5)
Привет, маленькое демо с репродукцией ошибки очень помогло бы понять в чем может быть причина
from react-yandex-maps.
https://codesandbox.io/s/21145v40z0
сначала переходим на ссылку /map
потом кликаем на TEST ссылку
я конечно могу в событии сделать проверку if (!map) return; там где ошибка, но хотелось бы узнать, почему именно то событие выполняется, когда перехожу по ссылке.
from react-yandex-maps.
@xfishernet react-yandex-maps will call the instanceRef callback with the YandexMap Object instance when the component mounts, and call it with null when it unmounts.
Тут конечно @gribnoysup подробнее пояснит. Но просто надо делать доп проверки на существование
https://codesandbox.io/s/34lr1w48r1
from react-yandex-maps.
@xfishernet как правильно заметил @mmarkelov происходит это потому что instanceRef
коллбэк будет вызван c аргументом null
, когда React вызывает коллбэк componentWillUnmount
. Это поведение повторяет поведение callback refs
в React:
React will call the ref callback with the DOM element when the component mounts, and call it with null when it unmounts.
https://reactjs.org/docs/refs-and-the-dom.html#callback-refs
Я закрою issue, но если у тебя остались вопросы, спрашивай
from react-yandex-maps.
Хочу выразить огромную благодарность вам. Но я хотел спосить об одной ошибке которая выходит у меня:
Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method. in YandexMapWrap
Я пробывал исправить это так:
class YandexMapWrap extends React.Component {
_isMounted = false;
componentDidMount() {
this._isMounted = true;
}
componentWillUnmount() {
this._isMounted = false;
}
}
и каждый раз проверяю на это когда вызываю this.setState()
но похожо что это не помогает.
Не могли вы подсказать почему так выходит и как исправить это ?
Thanks in advance!
from react-yandex-maps.
Related Issues (20)
- Изменить стили для Balloon (подсказки) - HOT 2
- Как при создании полигона, можно реализовать приклеивание вершины к другому полигону?
- 2022 год. Отключение ненужных модулей карты (поиск, пробки и прочие) HOT 1
- Как воспользоваться методом findOrganization ? HOT 1
- Размещение в скрытом контейнере HOT 1
- Get coordinates from RoutePanel
- Как присвоить свою иконку приходящему объекту JSON с массивом объектов type: 'Feature'?
- Placemark movement with animation
- Pass coords to point B on RoutePanel HOT 2
- yandex HOT 1
- RulerControl HOT 1
- Custom display of search results
- #RulerControl and make it default latatatiude and longitude in array list? HOT 2
- Ruler icon
- Отследить готовность компоненты
- Запятые при использовании метода map() в hint'е Яндекс карты (react-yandex-maps) HOT 2
- [Question] Как правильно определить iconShape при создании кастомного лейуата для Placemark
- Yandex maps are rendered twice React18 StrictMode HOT 7
- Узнать область показа карты.
- Поддержка React 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-yandex-maps.