From 6a0603feb5dd334a9b931475c2b5832825509732 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Fri, 17 Jul 2020 16:10:36 +1000 Subject: [PATCH] Fix map map cache bug with page reload --- src/network/NetworkedMapAndTokens.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/network/NetworkedMapAndTokens.js b/src/network/NetworkedMapAndTokens.js index 4a8e9ef..fd8c6b4 100644 --- a/src/network/NetworkedMapAndTokens.js +++ b/src/network/NetworkedMapAndTokens.js @@ -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);