mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
82bccd4040
Move the monitor snapshot off WiredCreatorToolsView's useState into useWiredCreatorToolsUiStore. The WiredMonitorDataEvent listener still lives in the component (it can't move alongside without dragging useMessageEvent into the store), but it now writes to setMonitorSnapshot and the room-change reset calls resetMonitorSnapshot() instead of re-instantiating the default in the component. Direct benefit: the snapshot now survives closing and reopening the panel between two server pushes. Before this commit, the parent remounted on every visibility flip (parent renders null while `!isVisible`) which dropped the snapshot back to the empty default; the user would briefly see zeroed stats until the next `monitor:fetch` roundtrip landed. Holding the snapshot in zustand decouples the data from the component's mount lifecycle. Tests: three new cases on the store cover setMonitorSnapshot, resetMonitorSnapshot returning a fresh empty instance, and the "close/reopen panel preserves snapshot" lifecycle. Total 181/181.