Fix map map cache bug with page reload

This commit is contained in:
Mitchell McCaffrey 2020-07-17 16:10:36 +10:00
parent 61a2e1ac8d
commit 6a0603feb5

View File

@ -252,7 +252,7 @@ function NetworkedMapAndTokens({ session }) {
if (id === "mapRequest") {
const map = getMap(data);
function replyWithFile(file) {
reply("mapResponse", { id: map.id, file }, "map");
reply("mapResponse", { ...map, file, resolutions: [] }, "map");
}
switch (map.quality) {
@ -284,11 +284,8 @@ function NetworkedMapAndTokens({ session }) {
}
}
if (id === "mapResponse") {
let update = { file: data.file };
const map = getMap(data.id);
updateMap(map.id, update).then(() => {
setCurrentMap({ ...map, ...update });
});
await putMap(data);
setCurrentMap(data);
}
if (id === "mapState") {
setCurrentMapState(data);