Moved asset load callbacks to take into account database insertion time

This commit is contained in:
Mitchell McCaffrey 2021-01-20 18:08:03 +11:00
parent 435752e7a9
commit 28b9886b06

View File

@ -370,8 +370,9 @@ function NetworkedMapAndTokens({ session }) {
if (id === "mapResponse") {
const newMap = data;
await putMap(newMap);
setCurrentMap(newMap);
await putMap(newMap);
assetLoadFinish();
}
if (id === "tokenRequest") {
@ -382,6 +383,7 @@ function NetworkedMapAndTokens({ session }) {
if (id === "tokenResponse") {
const newToken = data;
await putToken(newToken);
assetLoadFinish();
}
}
@ -389,9 +391,6 @@ function NetworkedMapAndTokens({ session }) {
if (count === 1) {
assetLoadStart();
}
if (total === count) {
assetLoadFinish();
}
assetProgressUpdate({ id, total, count });
}