fix(session): invalidate RoomSession snapshot on room-data and permission changes

getActiveRoomSessionSnapshot() caches the frozen snapshot keyed on the session
reference, but RoomDataHandler (tradeMode/groupId/isGuildRoom/doorMode/allowPets)
and RoomPermissionsHandler (controllerLevel/owner) mutate those fields on the
same session object without invalidating the cache. Any consumer reading a
mutable field via useActiveRoomSessionSnapshot would get stale data and never
re-render.

Expose invalidateRoomSessionSnapshot() on IRoomHandlerListener and call it from
both handlers after they mutate the session.
This commit is contained in:
simoleo89
2026-06-13 15:15:13 +02:00
parent a49c835870
commit 3ce15e5819
4 changed files with 10 additions and 1 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ export class RoomSessionManager implements IRoomSessionManager, IRoomHandlerList
private _savedPosY: number = -1;
private _activeRoomSessionSnapshot: Readonly<IRoomSessionSnapshot> | null = null;
private invalidateRoomSessionSnapshot(): void
public invalidateRoomSessionSnapshot(): void
{
this._activeRoomSessionSnapshot = null;