Fixed bug with large map sizes
This commit is contained in:
parent
f4a6252360
commit
73aec132e7
@ -55,7 +55,9 @@ export function MapDataProvider({ children }) {
|
||||
}
|
||||
|
||||
async function loadMaps() {
|
||||
let storedMaps = await database.table("maps").toArray();
|
||||
let storedMaps = [];
|
||||
// Use a cursor instead of toArray to prevent IPC max size error
|
||||
database.table("maps").each((map) => storedMaps.push(map));
|
||||
const sortedMaps = storedMaps.sort((a, b) => b.created - a.created);
|
||||
const defaultMapsWithIds = await getDefaultMaps();
|
||||
const allMaps = [...sortedMaps, ...defaultMapsWithIds];
|
||||
|
@ -30,7 +30,9 @@ export function TokenDataProvider({ children }) {
|
||||
}
|
||||
|
||||
async function loadTokens() {
|
||||
let storedTokens = await database.table("tokens").toArray();
|
||||
let storedTokens = [];
|
||||
// Use a cursor instead of toArray to prevent IPC max size error
|
||||
database.table("tokens").each((token) => storedTokens.push(token));
|
||||
const sortedTokens = storedTokens.sort((a, b) => b.created - a.created);
|
||||
const defaultTokensWithIds = getDefaultTokes();
|
||||
const allTokens = [...sortedTokens, ...defaultTokensWithIds];
|
||||
|
Loading…
Reference in New Issue
Block a user