refactor: prevent overwriting existing session on reconnect and improve player identity handling
All checks were successful
Build and Push Docker Image / docker (push) Successful in 9s

This commit is contained in:
2025-09-04 19:02:41 +02:00
parent f931d45932
commit 7361174b15
2 changed files with 35 additions and 8 deletions

View File

@@ -19,7 +19,11 @@ function showToast(msg) {
function handleConnected(msg) {
state.playerId = msg.playerId;
if (msg.sessionId) {
cacheSessionId(msg.sessionId);
// Don't clobber an existing session on reconnect; only set if none exists yet.
const existing = localStorage.getItem('sessionId');
if (!existing) {
cacheSessionId(msg.sessionId);
}
}
const stored = localStorage.getItem('playerName');
if (stored) {