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
@@ -5,4 +5,5 @@ export interface IRoomHandlerListener
getSession(id: number): IRoomSession;
sessionUpdate(id: number, type: string): void;
sessionReinitialize(fromRoomId: number, toRoomId: number): void;
invalidateRoomSessionSnapshot(): void;
}