Stop Losing Your Room Layout in the Check-out Report Builder
Stop Losing Your Room Layout in the Check-out Report Builder
Release: v0.1.158
The Problem
When working through a check-out report with many rooms, it's common practice to collapse rooms you've finished so you can focus on the ones still in progress. Until now, that layout was fragile: any time you added an item or saved your work, the page re-fetched data and all rooms snapped back to their expanded state.
For a report with 10 or more rooms, this meant repeatedly collapsing completed rooms after every single save — a repetitive interruption that made large inspections noticeably harder to manage.
What's Fixed
With v0.1.158, the collapse state of every room in the Check-out Report Builder is now stable and persistent.
Collapse state is lifted to the parent component
Previously, each RoomSection tracked its own collapsed flag in local component state (useState(false)). Because React re-mounts or re-renders components on data invalidation, that local state was lost every time a trpc query refreshed.
The collapsed/expanded state for all rooms is now held in the parent CheckOutReportBuilder, stored as a map keyed by room ID. Individual room sections read from and write to this shared map — so a data refresh in the background no longer touches the layout.
Persisted to localStorage
The collapse map is saved to localStorage under:
checkout-room-collapse-{reportId}
This means your room layout is preserved not just across saves within a session, but also across full page reloads and browser refreshes. If you leave a report mid-way and return later, completed rooms stay collapsed exactly as you left them.
Smart auto-collapse for completed rooms
The builder will automatically collapse a room when:
- All items in the room have been rated, and
- No items in the room have deteriorated (i.e. no deductions are flagged)
This keeps the view focused on rooms that still need attention without requiring any manual action. Rooms with outstanding work, or rooms containing items flagged for deduction, remain expanded.
Summary of Changes
| Before | After |
|---|---|
| Each room tracks its own collapse state locally | Collapse state is managed centrally in the parent component |
| Collapse state resets on every data refresh | Collapse state survives re-renders and re-fetches |
| State lost on page reload | State persisted to localStorage per report ID |
| No automatic collapsing | Fully-rated, undamaged rooms collapse automatically |
Who Benefits
This fix is most impactful for:
- Agents and clerks conducting large check-outs with many rooms
- Any user working through a report across multiple sessions or with slow connections that trigger frequent background refreshes
No configuration is required — the improvement is automatic for all check-out reports.