Add loading indicator to file map select and allow selecting no maps

This commit is contained in:
Mitchell McCaffrey 2021-03-19 16:11:25 +11:00
parent aa33e6c341
commit 25ea29fb26

View File

@ -328,9 +328,11 @@ function SelectMapModal({
const map = selectedMaps[0];
const mapState = await getMapStateFromDB(map.id);
if (map.type === "file") {
setIsLoading(true);
await updateMap(map.id, { lastUsed });
const updatedMap = await getMapFromDB(map.id);
onMapChange(updatedMap, mapState);
setIsLoading(false);
} else {
onMapChange(map, mapState);
}
@ -433,7 +435,7 @@ function SelectMapModal({
/>
<Button
variant="primary"
disabled={isLoading || selectedMapIds.length !== 1}
disabled={isLoading || selectedMapIds.length > 1}
onClick={handleDone}
mt={2}
>