Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit c692795

Browse files
committed
Fix instabilities with automatic login after restarts
When many bundles are loaded nodecg takes it's time after a connection till all replicants are usable, which are required to do the login. Therefore this PR waits for about 200ms after the connection is established to let nodecg connect fully.
1 parent 5c8d7a9 commit c692795

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

nodecg-io-core/dashboard/authentication.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ inputPassword?.addEventListener("keyup", function (event) {
2121

2222
// Handler for when the socket.io client re-connects which is usually a nodecg restart.
2323
nodecg.socket.on("connect", () => {
24-
// If a password has been entered previously try to directly login using it.
25-
if (inputPassword.value !== "") {
26-
loadFramework();
27-
} else {
28-
updateLoadedStatus();
29-
updateFirstStartupLabel();
30-
}
24+
// Give nodecg 200ms to fully connect so everything is usable.
25+
setTimeout(() => {
26+
// If a password has been entered previously try to directly login using it.
27+
if (inputPassword.value !== "") {
28+
loadFramework();
29+
} else {
30+
updateLoadedStatus();
31+
updateFirstStartupLabel();
32+
}
33+
}, 200);
3134
});
3235

3336
document.addEventListener("DOMContentLoaded", () => {

0 commit comments

Comments
 (0)