Fix deleting map not removing map from map view

This commit is contained in:
Mitchell McCaffrey 2020-10-13 07:10:51 +11:00
parent c543f15c81
commit 9ff6053498
2 changed files with 5 additions and 2 deletions

View File

@ -32,8 +32,7 @@ function MapInteraction({
useEffect(() => {
if (map === null) {
setMapLoaded(false);
}
if (mapImageSourceStatus === "loaded") {
} else if (mapImageSourceStatus === "loaded") {
setMapLoaded(true);
}
}, [mapImageSourceStatus, map]);

View File

@ -3,6 +3,8 @@ import useImage from "use-image";
import useDataSource from "./useDataSource";
import { isEmpty } from "./shared";
import { mapSources as defaultMapSources } from "../maps";
function useMapImage(map) {
@ -38,6 +40,8 @@ function useMapImage(map) {
if (map.file && map.quality !== mapSourceMap.quality) {
updateMapSource();
}
} else if (!map && !isEmpty(mapSourceMap)) {
setMapSourceMap({});
}
}, [map, mapSourceMap]);