Browse Source

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

Kristian Vos 3 năm trước cách đây
mục cha
commit
688b29fd87
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  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 = [];