aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/core/MapView.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-12-07 17:33:28 -0800
committerAnton Tananaev <anton@traccar.org>2022-12-07 17:33:28 -0800
commit55400d4286f07fedcbfa7263de3ba663b811dbf2 (patch)
tree4ead85bf2def91805b368ca98bcbd89c5023a68d /modern/src/map/core/MapView.js
parent376255707d7b21503a752dfcc4bd9b3f6623e908 (diff)
downloadtrackermap-web-55400d4286f07fedcbfa7263de3ba663b811dbf2.tar.gz
trackermap-web-55400d4286f07fedcbfa7263de3ba663b811dbf2.tar.bz2
trackermap-web-55400d4286f07fedcbfa7263de3ba663b811dbf2.zip
Fallback map styles
Diffstat (limited to 'modern/src/map/core/MapView.js')
-rw-r--r--modern/src/map/core/MapView.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/modern/src/map/core/MapView.js b/modern/src/map/core/MapView.js
index 2c49b8ba..35b3a65a 100644
--- a/modern/src/map/core/MapView.js
+++ b/modern/src/map/core/MapView.js
@@ -91,8 +91,9 @@ const MapView = ({ children }) => {
}, [mapboxAccessToken]);
useEffect(() => {
- const filteredStyles = mapStyles.filter((style) => style.available && activeMapStyles.includes(style.id));
- switcher.updateStyles(filteredStyles, defaultMapStyle);
+ const filteredStyles = mapStyles.filter((s) => s.available && activeMapStyles.includes(s.id));
+ const styles = filteredStyles.length ? filteredStyles : mapStyles.filter((s) => s.id === 'osm');
+ switcher.updateStyles(styles, defaultMapStyle);
}, [mapStyles, defaultMapStyle]);
useEffect(() => {