Fixed bug that caused a crash when a map was deleted with unsaved changes
This commit is contained in:
parent
73180ee1cd
commit
529fd2caae
@ -102,7 +102,7 @@ function MapSettings({
|
|||||||
</Box>
|
</Box>
|
||||||
<Flex
|
<Flex
|
||||||
mt={2}
|
mt={2}
|
||||||
mb={map.type === "default" ? 2 : 0}
|
mb={mapEmpty || map.type === "default" ? 2 : 0}
|
||||||
sx={{ alignItems: "flex-end" }}
|
sx={{ alignItems: "flex-end" }}
|
||||||
>
|
>
|
||||||
<Box sx={{ width: "50%" }}>
|
<Box sx={{ width: "50%" }}>
|
||||||
@ -154,8 +154,9 @@ function MapSettings({
|
|||||||
key={quality.id}
|
key={quality.id}
|
||||||
value={quality.id}
|
value={quality.id}
|
||||||
disabled={
|
disabled={
|
||||||
quality.id !== "original" &&
|
mapEmpty ||
|
||||||
!map.resolutions[quality.id]
|
(quality.id !== "original" &&
|
||||||
|
!map.resolutions[quality.id])
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{quality.name}
|
{quality.name}
|
||||||
|
@ -174,9 +174,9 @@ function SelectMapModal({
|
|||||||
|
|
||||||
async function handleMapRemove(id) {
|
async function handleMapRemove(id) {
|
||||||
await removeMap(id);
|
await removeMap(id);
|
||||||
setSelectedMapId(null);
|
|
||||||
setMapSettingChanges({});
|
setMapSettingChanges({});
|
||||||
setMapStateSettingChanges({});
|
setMapStateSettingChanges({});
|
||||||
|
setSelectedMapId(null);
|
||||||
// Removed the map from the map screen if needed
|
// Removed the map from the map screen if needed
|
||||||
if (currentMap && currentMap.id === selectedMapId) {
|
if (currentMap && currentMap.id === selectedMapId) {
|
||||||
onMapChange(null, null);
|
onMapChange(null, null);
|
||||||
@ -265,8 +265,11 @@ function SelectMapModal({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedMapWithChanges = { ...selectedMap, ...mapSettingChanges };
|
const selectedMapWithChanges = selectedMap && {
|
||||||
const selectedMapStateWithChanges = {
|
...selectedMap,
|
||||||
|
...mapSettingChanges,
|
||||||
|
};
|
||||||
|
const selectedMapStateWithChanges = selectedMapState && {
|
||||||
...selectedMapState,
|
...selectedMapState,
|
||||||
...mapStateSettingChanges,
|
...mapStateSettingChanges,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user