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
All checks were successful
Build and Push Docker Image / docker (push) Successful in 9s
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user