Преглед на файлове

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

Kristian Vos преди 3 години
родител
ревизия
688b29fd87
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  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 = [];