Update maps and tokens to have thumbnails and removed loading of all files on load

This commit is contained in:
Mitchell McCaffrey
2021-02-08 16:53:56 +11:00
parent b9993e1a0b
commit 24e64f9d32
16 changed files with 418 additions and 137 deletions

View File

@@ -69,6 +69,7 @@ export function MapDataProvider({ children }) {
return defaultMapsWithIds;
}
// Loads maps without the file data to save memory
async function loadMaps() {
let storedMaps = [];
// Try to load maps with worker, fallback to database if failed
@@ -77,7 +78,10 @@ export function MapDataProvider({ children }) {
storedMaps = decode(packedMaps);
} else {
console.warn("Unable to load maps with worker, loading may be slow");
await database.table("maps").each((map) => storedMaps.push(map));
await database.table("maps").each((map) => {
const { file, resolutions, ...rest } = map;
storedMaps.push(rest);
});
}
const sortedMaps = storedMaps.sort((a, b) => b.created - a.created);
const defaultMapsWithIds = await getDefaultMaps();