diff options
author | Anton Tananaev <anton@traccar.org> | 2022-04-17 11:29:43 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-04-17 11:29:43 -0700 |
commit | 2054cc9d11d77d7883a5858bcbcc3833aed4b874 (patch) | |
tree | b953ff5f18f037c33904a431675686ab579970d2 /modern/src/map/PositionsMap.js | |
parent | de73ecd28f8428c026a25225573c971250723528 (diff) | |
download | trackermap-web-2054cc9d11d77d7883a5858bcbcc3833aed4b874.tar.gz trackermap-web-2054cc9d11d77d7883a5858bcbcc3833aed4b874.tar.bz2 trackermap-web-2054cc9d11d77d7883a5858bcbcc3833aed4b874.zip |
Fix effect dependencies
Diffstat (limited to 'modern/src/map/PositionsMap.js')
-rw-r--r-- | modern/src/map/PositionsMap.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modern/src/map/PositionsMap.js b/modern/src/map/PositionsMap.js index 791c7abe..cabce3df 100644 --- a/modern/src/map/PositionsMap.js +++ b/modern/src/map/PositionsMap.js @@ -62,7 +62,7 @@ const PositionsMap = ({ positions }) => { .addTo(map); }, [history]); - const onClusterClick = (event) => { + const onClusterClick = useCallback((event) => { const features = map.queryRenderedFeatures(event.point, { layers: [clusters], }); @@ -75,7 +75,7 @@ const PositionsMap = ({ positions }) => { }); } }); - }; + }, [clusters]); useEffect(() => { map.addSource(id, { @@ -148,7 +148,7 @@ const PositionsMap = ({ positions }) => { map.removeSource(id); } }; - }, [onMarkerClick]); + }, [clusters, onMarkerClick, onClusterClick]); useEffect(() => { map.getSource(id).setData({ |