mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 15:06:20 +00:00
761d8ffe1988ce971654aaf351569410724daf23
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).
Nitro Renderer
nitro-renderer is a Javascript library for rendering Nitro in the browser using PixiJS
Installation
npm
npm install @nitrots/nitro-renderer
yarn
yarn add @nitrots/nitro-renderer
Languages
TypeScript
99.9%
JavaScript
0.1%