feat: search other pages when photo not found in suggested page#4311
feat: search other pages when photo not found in suggested page#4311
Conversation
Agent-Logs-Url: https://github.com/LycheeOrg/Lychee/sessions/b47b7a17-9ec6-4479-a156-082e27b74a02 Co-authored-by: ildyria <627094+ildyria@users.noreply.github.com>
📝 WalkthroughWalkthroughThe album loader now accepts an optional photoId; when given and not found on the initial page, the store sequentially loads other pages (backwards then forwards) until the photo appears, with albumId checks to abort on navigation and skips background prepends to avoid duplicate loads. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
resources/js/stores/AlbumState.ts (1)
351-375: Sequential full-album scan can be an expensive fallback; consider a server-side photo→page lookup.For large albums where the hinted
?page=Nis wrong, this walks every page serially, with eachloadPhotosawaiting the network round-trip before deciding whether to continue. On a 50-page album with the photo on page 50, that's 49 sequential requests — visible latency plus extra DB/IO load server-side.Options worth weighing:
- Add a cheap endpoint like
GET /Album/{id}/photos/locate?photoId=X&perPage=Yreturning{ page }, then load only that page. This collapses the worst case from O(pages) round-trips to 2.- Alternatively, parallelize the scan with a small concurrency window and
AbortControlleronce the photo is found (still O(N) server work, but wall-clock better).- Capping the search with a sensible max (e.g., search ±K pages, then give up and fall back to the initial page view) would at least bound the waterfall.
Happy to sketch an implementation if useful.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: afa74599-44d6-4181-9852-94b6f528d649
📒 Files selected for processing (2)
resources/js/stores/AlbumState.tsresources/js/views/gallery-panels/Album.vue
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit
New Features
Bug Fixes / Improvements