From 58b70a46debf2ed4734df243c936e58e0075adf2 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Sat, 24 Oct 2020 08:23:06 +1100 Subject: [PATCH] Fix another error with fake-indexeddb --- src/contexts/MapDataContext.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/contexts/MapDataContext.js b/src/contexts/MapDataContext.js index 26f4462..c1278a8 100644 --- a/src/contexts/MapDataContext.js +++ b/src/contexts/MapDataContext.js @@ -229,7 +229,13 @@ export function MapDataProvider({ children }) { } async function getMapFromDB(mapId) { - return await database.table("maps").get(mapId); + let map = await database.table("maps").get(mapId); + // Check state maps if not in database as a work around for the fake-indexeddb error + // TODO: remove this when the error if fixed + if (!map) { + map = getMap(mapId); + } + return map; } const ownedMaps = maps.filter((map) => map.owner === userId);