diff --git a/.dist/index.js b/.dist/index.js index 4790c9a..641cc48 100644 --- a/.dist/index.js +++ b/.dist/index.js @@ -37,6 +37,7 @@ function showAccountSwitcher() { table.append(userinfo); userinfo.addEventListener("click", _ => { thisuser.unload(); + thisuser.swapped = true; document.getElementById("loading").classList.remove("doneloading"); document.getElementById("loading").classList.add("loading"); thisuser = new Localuser(specialuser); diff --git a/.dist/localuser.js b/.dist/localuser.js index d5f713f..ef83bd0 100644 --- a/.dist/localuser.js +++ b/.dist/localuser.js @@ -111,6 +111,7 @@ class Localuser { SnowFlake.clear(); User.clear(); } + swapped = false; async initwebsocket() { let returny = null; const promise = new Promise((res) => { returny = res; }); @@ -210,7 +211,7 @@ class Localuser { this.connectionSucceed = 0; document.getElementById("load-desc").innerHTML = "Unable to connect to the Spacebar server, retrying in " + Math.round(0.2 + (this.errorBackoff * 2.8)) + " seconds..."; setTimeout(() => { - if (!this.initialized) + if (this.swapped) return; document.getElementById("load-desc").textContent = "Retrying..."; this.initwebsocket().then(() => { diff --git a/webpage/index.ts b/webpage/index.ts index 7baab8f..9ac4101 100644 --- a/webpage/index.ts +++ b/webpage/index.ts @@ -46,6 +46,7 @@ function showAccountSwitcher(){ table.append(userinfo); userinfo.addEventListener("click",_=>{ thisuser.unload(); + thisuser.swapped=true; document.getElementById("loading").classList.remove("doneloading"); document.getElementById("loading").classList.add("loading"); thisuser=new Localuser(specialuser); diff --git a/webpage/localuser.ts b/webpage/localuser.ts index 09aed77..d3ae804 100644 --- a/webpage/localuser.ts +++ b/webpage/localuser.ts @@ -117,6 +117,7 @@ class Localuser{ SnowFlake.clear(); User.clear(); } + swapped=false; async initwebsocket():Promise{ let returny=null const promise=new Promise((res)=>{returny=res}); @@ -221,7 +222,7 @@ class Localuser{ document.getElementById("load-desc").innerHTML="Unable to connect to the Spacebar server, retrying in " + Math.round(0.2 + (this.errorBackoff*2.8)) + " seconds..."; setTimeout(() => { - if(!this.initialized) return; + if(this.swapped) return; document.getElementById("load-desc").textContent="Retrying..."; this.initwebsocket().then(() => { this.loaduser();