From c7e2a10652da8feab23d5cc871e783f2a8ad8c92 Mon Sep 17 00:00:00 2001 From: Jage9 Date: Sun, 22 Feb 2026 19:04:54 -0500 Subject: [PATCH] reconnect: account for delayed autofill nickname before auto-connect after version reload --- client/public/version.js | 2 +- client/src/main.ts | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/client/public/version.js b/client/public/version.js index 7e96c6c..cc91bca 100644 --- a/client/public/version.js +++ b/client/public/version.js @@ -1,5 +1,5 @@ // Maintainer-controlled web client version. // Format: YYYY.MM.DD Rn (example: 2026.02.20 R2) -window.CHGRID_WEB_VERSION = "2026.02.22 R169"; +window.CHGRID_WEB_VERSION = "2026.02.22 R170"; // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid. window.CHGRID_TIME_ZONE = "America/Detroit"; diff --git a/client/src/main.ts b/client/src/main.ts index 85105ff..d1f87d2 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -2201,9 +2201,17 @@ updateStatus('Welcome to the Chat Grid. Press the Settings button to configure y try { if (sessionStorage.getItem(AUTO_RECONNECT_AFTER_RELOAD_KEY) === '1') { sessionStorage.removeItem(AUTO_RECONNECT_AFTER_RELOAD_KEY); - if (storedNickname) { - void connect(); - } + window.setTimeout(() => { + const effectiveNickname = sanitizeName(dom.preconnectNickname.value || storedNickname); + if (effectiveNickname) { + dom.preconnectNickname.value = effectiveNickname; + state.player.nickname = effectiveNickname; + updateConnectAvailability(); + void connect(); + return; + } + updateConnectAvailability(); + }, 250); } } catch { // Ignore sessionStorage failures.