Skip to content

Commit

Permalink
Fix map overlay flickering
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Mar 15, 2024
1 parent 5b1c766 commit 7016950
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions modern/src/map/core/useMapStyles.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useMemo } from 'react';
import { useSelector } from 'react-redux';
import { useTranslation } from '../../common/components/LocalizationProvider';
import { useAttributePreference } from '../../common/util/preferences';
Expand Down Expand Up @@ -37,7 +38,7 @@ export default () => {
const mapboxAccessToken = useAttributePreference('mapboxAccessToken');
const customMapUrl = useSelector((state) => state.session.server.mapUrl);

return [
return useMemo(() => [
{
id: 'locationIqStreets',
title: t('mapLocationIqStreets'),
Expand Down Expand Up @@ -254,5 +255,5 @@ export default () => {
}),
available: !!customMapUrl,
},
];
], [t, mapTilerKey, locationIqKey, bingMapsKey, tomTomKey, hereKey, mapboxAccessToken, customMapUrl]);
};
2 changes: 1 addition & 1 deletion modern/src/map/overlay/MapOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const MapOverlay = () => {
map.removeSource(id);
}
};
});
}, [id, activeOverlay]);

return null;
};
Expand Down
5 changes: 3 additions & 2 deletions modern/src/map/overlay/useMapOverlays.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useMemo } from 'react';
import { useSelector } from 'react-redux';
import { useTranslation } from '../../common/components/LocalizationProvider';
import { useAttributePreference } from '../../common/util/preferences';
Expand All @@ -21,7 +22,7 @@ export default () => {
const hereKey = useAttributePreference('hereKey');
const customMapOverlay = useSelector((state) => state.session.server.overlayUrl);

return [
return useMemo(() => [
{
id: 'openSeaMap',
title: t('mapOpenSeaMap'),
Expand Down Expand Up @@ -98,5 +99,5 @@ export default () => {
source: sourceCustom(customMapOverlay),
available: !!customMapOverlay,
},
];
], [t, openWeatherKey, tomTomKey, hereKey, customMapOverlay]);
};

0 comments on commit 7016950

Please sign in to comment.