reconnect: account for delayed autofill nickname before auto-connect after version reload

This commit is contained in:
Jage9
2026-02-22 19:04:54 -05:00
parent 0155446ec0
commit c7e2a10652
2 changed files with 12 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
// Maintainer-controlled web client version. // Maintainer-controlled web client version.
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2) // 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. // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
window.CHGRID_TIME_ZONE = "America/Detroit"; window.CHGRID_TIME_ZONE = "America/Detroit";

View File

@@ -2201,9 +2201,17 @@ updateStatus('Welcome to the Chat Grid. Press the Settings button to configure y
try { try {
if (sessionStorage.getItem(AUTO_RECONNECT_AFTER_RELOAD_KEY) === '1') { if (sessionStorage.getItem(AUTO_RECONNECT_AFTER_RELOAD_KEY) === '1') {
sessionStorage.removeItem(AUTO_RECONNECT_AFTER_RELOAD_KEY); sessionStorage.removeItem(AUTO_RECONNECT_AFTER_RELOAD_KEY);
if (storedNickname) { window.setTimeout(() => {
const effectiveNickname = sanitizeName(dom.preconnectNickname.value || storedNickname);
if (effectiveNickname) {
dom.preconnectNickname.value = effectiveNickname;
state.player.nickname = effectiveNickname;
updateConnectAvailability();
void connect(); void connect();
return;
} }
updateConnectAvailability();
}, 250);
} }
} catch { } catch {
// Ignore sessionStorage failures. // Ignore sessionStorage failures.