From 33f1bc42a9441cba4c4cef81217a3073bbfd4e8b Mon Sep 17 00:00:00 2001 From: peipeimo <150317697+peipeimo@users.noreply.github.com> Date: Mon, 27 Jul 2026 18:10:27 -0400 Subject: [PATCH] fix: sync gallery feedback filters after lightbox like/rating in simple mode (#882) In simple identity mode, likes and ratings submitted from the lightbox never called onFeedbackChange, so the gallery's photo list (whose like_count drives the Likes/Rated feedback filter chips) stayed stale until a full page reload. Liked photos were missing from the Likes filter; unliked photos stayed stuck in it. The guest-identity-mode paths and the grid PhotoCard paths already call onFeedbackChange after submitting - the simple-mode lightbox paths were the only ones missing it. Add the call to the three missing paths: submitLike (simple branch), submitRating (simple branch), and the FeedbackIdentityModal onSubmit handler. Verified locally (Docker build of main): like a photo in the lightbox after navigating with Next/Prev, open the Likes filter - the photo now appears immediately with no reload, and filter contents match the admin feedback API exactly. --- frontend/src/components/gallery/PhotoLightbox.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/src/components/gallery/PhotoLightbox.tsx b/frontend/src/components/gallery/PhotoLightbox.tsx index 84f0052c..56d62400 100644 --- a/frontend/src/components/gallery/PhotoLightbox.tsx +++ b/frontend/src/components/gallery/PhotoLightbox.tsx @@ -288,6 +288,11 @@ export const PhotoLightbox: React.FC = ({ setLikeCount(c => Math.max(0, c + (next ? 1 : -1))); return next; }); + // Keep the gallery's photo list (like_count drives the feedback + // filter chips) in sync — the guest-mode path above already does + // this; without it, likes made in the lightbox don't appear in + // the Likes filter until a full page reload. + if (onFeedbackChange) onFeedbackChange(); } catch (err) { if (handleLimitError(err)) return; // eslint-disable-next-line no-console @@ -342,6 +347,9 @@ export const PhotoLightbox: React.FC = ({ setAvgRating(Number(fresh.summary?.average_rating) || 0); setTotalRatings(Number(fresh.summary?.total_ratings) || 0); } catch {} + // Sync gallery photo list so the Rated filter reflects this rating + // without a reload (parity with the guest-mode path above). + if (onFeedbackChange) onFeedbackChange(); }; const goToPrevious = () => { @@ -1010,6 +1018,9 @@ export const PhotoLightbox: React.FC = ({ }); setMyRating(pendingAction.rating); } + // Sync gallery photo list (feedback filter chips) — parity with + // the direct submit paths. + if (onFeedbackChange) onFeedbackChange(); setPendingAction(null); }} feedbackType={pendingAction?.type === 'rating' ? 'rating' : 'like'}