diff --git a/src/core/passport.js b/src/core/passport.js index e1fa0e70..4075a71e 100644 --- a/src/core/passport.js +++ b/src/core/passport.js @@ -82,6 +82,7 @@ async function oauth_login(email, name, discordid = null) { while (reguser) { // name is taken by someone else name = `${name.substring(0, 15)}-${Math.random().toString(36).substring(2, 10)}`; + // eslint-disable-next-line no-await-in-loop reguser = await RegUser.findOne({ where: { name } }); } reguser = await RegUser.create({ diff --git a/src/ui/ChunkRGB.js b/src/ui/ChunkRGB.js index bb450e8a..325e5144 100644 --- a/src/ui/ChunkRGB.js +++ b/src/ui/ChunkRGB.js @@ -8,8 +8,11 @@ import { TILE_SIZE, TILE_LOADING_IMAGE } from '../core/constants'; import loadImage from './loadImage'; -export let loadingTile = null; -loadImage(TILE_LOADING_IMAGE).then((img) => { loadingTile = img; }); +export const loadingTile = { + url: TILE_LOADING_IMAGE, + img: null, +}; +loadImage(TILE_LOADING_IMAGE).then((img) => { loadingTile.img = img; }); class ChunkRGB { @@ -66,8 +69,8 @@ class ChunkRGB { return; } } - if (loadingTile) { - ctx.drawImage(loadingTile, 0, 0); + if (loadingTile.img) { + ctx.drawImage(loadingTile.img, 0, 0); return; } else { ctx.fillStyle = this.palette.colors[2]; diff --git a/src/ui/Renderer.js b/src/ui/Renderer.js index 026fd950..1040d022 100644 --- a/src/ui/Renderer.js +++ b/src/ui/Renderer.js @@ -205,7 +205,7 @@ class Renderer { if (chunk.ready) { context.drawImage(chunk.image, x, y); if (fetch) chunk.timestamp = curTime; - } else if (loadingTile) context.drawImage(loadingTile, x, y); + } else if (loadingTile.img) context.drawImage(loadingTile.img, x, y); else context.fillRect(x, y, TILE_SIZE, TILE_SIZE); } else { // we don't have that chunk @@ -216,7 +216,7 @@ class Renderer { store.dispatch(fetchTile(canvasId, [tiledZoom, cx, cy])); } } - if (loadingTile) context.drawImage(loadingTile, x, y); + if (loadingTile.img) context.drawImage(loadingTile.img, x, y); else context.fillRect(x, y, TILE_SIZE, TILE_SIZE); } } @@ -248,7 +248,7 @@ class Renderer { if (!view || canvasId === null) return; - if (this.canvasId != canvasId) { + if (this.canvasId !== canvasId) { const { canvasSize, palette, canvasMaxTiledZoom } = state.canvas; this.canvasSize = canvasSize; this.palette = palette;