You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 15:06:20 +00:00
feat(session): snapshot getter for UserDataManager room user list
Extends the snapshot pattern to the room's user list. The React client currently has many widgets each calling `getUserDataByIndex(idx)` in a loop (chat, doorbell, room player list, infostand …) — every render walks the underlying Map and rebuilds an array. With `getRoomUserListSnapshot(): ReadonlyArray<IRoomUserData>` consumers can memoize on the array reference and only rebuild when something actually changed. Invalidation fires on every state-changing path: - updateUserData (add/replace) - removeUserData (leave) - updateFigure / updateName / updateMotto / updateNickIcon / updateCustomization / updateBackground / updateAchievementScore / updatePetLevel / updatePetBreedingStatus The inner IRoomUserData objects keep their existing in-place mutation semantics (deep-clone would be too expensive for 30+ avatars on every single status push). Consumers should treat each entry as a snapshot-at-time-of-read and not retain references across an invalidation. New event: NitroEventType.ROOM_USER_LIST_UPDATED. Interface and event additions are backwards-compatible; no existing accessors changed. Also tidied: `updatePetLevel` now uses the explicit `if(!userData) return;` guard pattern matching the rest of the methods (was a one-line inline conditional).
This commit is contained in:
@@ -21,4 +21,5 @@ export class NitroEventType
|
||||
public static readonly ROOM_SESSION_UPDATED = 'ROOM_SESSION_UPDATED';
|
||||
public static readonly IGNORED_USERS_UPDATED = 'IGNORED_USERS_UPDATED';
|
||||
public static readonly GROUP_BADGES_UPDATED = 'GROUP_BADGES_UPDATED';
|
||||
public static readonly ROOM_USER_LIST_UPDATED = 'ROOM_USER_LIST_UPDATED';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user