mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 23:16:21 +00:00
8b7bedf534
The four useMessageEvent handlers in useInventoryFurniState (furniture list add/update, list, removed, plus the dead post-it-placed listener) were inlined as ~250 LOC of merge logic inside setGroupItems callbacks. Three things change: - The three meaningful reducers move to useInventoryFurni.reducers.ts as applyFurnitureListAddOrUpdate / applyFurnitureList / applyFurnitureListRemoved, plus two helpers clearUnseenFlags and refreshGroupItemsLocalization for the existing effect-driven mutations. Side effects (CreateLinkEvent, attemptItemPlacement, dispatchAdded) are passed in via a ctx object so the reducers stay easy to test. - The module-level furniMsgFragments buffer becomes a useRef, removing a latent bug where two simultaneous client instances would have trampled each other's fragments. - The empty FurniturePostItPlacedEvent handler is dropped (dead code). useInventoryFurni still owns groupItems via useState so the existing effect-driven setters (unseen flag reset, localization refresh) keep working; the message handlers now call setGroupItems(prev => applyX(prev, event, ctx)) with the extracted reducers.