From a56062d353122318f4962658dc258788c8e21441 Mon Sep 17 00:00:00 2001 From: dtoro Date: Wed, 8 Apr 2026 21:13:08 +0200 Subject: [PATCH] fix: preview navigation walks the timeline's visible order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously the preview view walked the raw API photos array for arrow navigation and the filmstrip. In tag-grouped mode (and any future layout where the visible grid order diverges from the API sort) that diverged from the order the user actually saw — they'd hit ← / → and land on a photo that wasn't adjacent in the grid. Fix: Timeline publishes its flat visible-order id sequence into the photo store as visiblePhotoIds whenever its layout items change (including duplicates from tag buckets, which is what the user wants in tag mode — landing on a photo's second appearance in the next bucket is the right behavior). PreviewView resolves that sequence back to Photo objects via the rawPhotos map and uses the result for both arrow nav and the filmstrip. Falls back to the raw photos list when the sequence isn't populated yet. Also clean up the lingering hardcoded http://localhost:8001 in usePhotosQuery — switched to the shared axios instance with the relative /api/v1 baseURL so the hook works cross-machine through the nginx / vite proxy. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/components/layout/RightSidebar.tsx | 4 ++-- .../src/components/preview/PreviewView.tsx | 21 +++++++++++++++++-- frontend/src/components/timeline/Timeline.tsx | 16 ++++++++++++++ frontend/src/hooks/usePhotosQuery.ts | 9 +++++--- frontend/src/store/photoStore.ts | 10 +++++++++ 5 files changed, 53 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/layout/RightSidebar.tsx b/frontend/src/components/layout/RightSidebar.tsx index f6d115b..8b7c4d5 100644 --- a/frontend/src/components/layout/RightSidebar.tsx +++ b/frontend/src/components/layout/RightSidebar.tsx @@ -150,8 +150,8 @@ export function RightSidebar() { const id = activePhotoId ?? selectedPhotos[0] return (
-
-

Photo Details

+
+

Metadata