Browse Source

fix: attempted to fix ws issue where onConnect was sometimes called twice in a row

Kristian Vos 3 years ago
parent
commit
688b29fd87
1 changed files with 3 additions and 2 deletions
  1. 3 2
      frontend/src/ws.js

+ 3 - 2
frontend/src/ws.js

@@ -149,11 +149,12 @@ export default {
 			firstInit = false;
 			this.socket.on("ready", () => {
 				console.log("WS: SOCKET READY");
+
+				onConnect.forEach(cb => cb());
+
 				ready = true;
 
 				setTimeout(() => {
-					onConnect.forEach(cb => cb());
-
 					// dispatches that were attempted while the server was offline
 					pendingDispatches.forEach(cb => cb());
 					pendingDispatches = [];