tui: gallery auto-refresh on generation complete and storage mutations #122

Closed
opened 2026-04-12 22:02:30 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As a user, I want the gallery to update automatically when I generate a new image or delete/favorite an item from another screen, so that I don't have to manually press r to see changes.

Problem

The gallery screen only loads items from storage on first render or when needs_load is manually set (by sort/search/delete within the gallery itself). After the Generate screen saves an image to gallery via GalleryStorage::insert(), the Gallery screen has no way to know — it doesn't listen to LoomEvent::ImageGenerated or any storage-change event.

Acceptance criteria

  • Gallery screen handles Event::CoreMsg(LoomEvent::ImageGenerated { .. }) by setting needs_load = true
  • Gallery screen handles a new LoomEvent::GalleryChanged event for deletes, favorites, and imports
  • Generate screen's save_to_gallery() publishes LoomEvent::GalleryChanged after successful insert
  • Gallery delete/favorite operations publish LoomEvent::GalleryChanged so other open views stay in sync
  • Gallery grid preserves scroll position and selection after auto-refresh (clamp to valid range)
  • Grid thumbnail cache (grid_images) is cleared on refresh so stale thumbnails don't persist
  • Manual r key still works as a force-refresh

Out of scope

  • Cross-instance sync (D-Bus / IPC between multiple loom-tui processes)
  • Gallery websocket push from backend

References

  • crates/loom-tui/src/screens/gallery.rsload_from_storage(), needs_load flag
  • crates/loom-tui/src/screens/generate.rssave_to_gallery()
  • crates/loom-core/src/event_bus.rsLoomEvent enum
## User story As a user, I want the gallery to update automatically when I generate a new image or delete/favorite an item from another screen, so that I don't have to manually press `r` to see changes. ## Problem The gallery screen only loads items from storage on first render or when `needs_load` is manually set (by sort/search/delete within the gallery itself). After the Generate screen saves an image to gallery via `GalleryStorage::insert()`, the Gallery screen has no way to know — it doesn't listen to `LoomEvent::ImageGenerated` or any storage-change event. ## Acceptance criteria - [ ] Gallery screen handles `Event::CoreMsg(LoomEvent::ImageGenerated { .. })` by setting `needs_load = true` - [ ] Gallery screen handles a new `LoomEvent::GalleryChanged` event for deletes, favorites, and imports - [ ] Generate screen's `save_to_gallery()` publishes `LoomEvent::GalleryChanged` after successful insert - [ ] Gallery delete/favorite operations publish `LoomEvent::GalleryChanged` so other open views stay in sync - [ ] Gallery grid preserves scroll position and selection after auto-refresh (clamp to valid range) - [ ] Grid thumbnail cache (`grid_images`) is cleared on refresh so stale thumbnails don't persist - [ ] Manual `r` key still works as a force-refresh ## Out of scope - Cross-instance sync (D-Bus / IPC between multiple loom-tui processes) - Gallery websocket push from backend ## References - `crates/loom-tui/src/screens/gallery.rs` — `load_from_storage()`, `needs_load` flag - `crates/loom-tui/src/screens/generate.rs` — `save_to_gallery()` - `crates/loom-core/src/event_bus.rs` — `LoomEvent` enum
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/loom#122
No description provided.