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.
This commit is contained in:
@@ -288,6 +288,11 @@ export const PhotoLightbox: React.FC<PhotoLightboxProps> = ({
|
||||
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<PhotoLightboxProps> = ({
|
||||
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<PhotoLightboxProps> = ({
|
||||
});
|
||||
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'}
|
||||
|
||||
Reference in New Issue
Block a user