AOSSIE-Org / AOSSIE-Org/PictoPy
BUG: Navigating back from person view shows incorrect gallery images
- Ngôn ngữ chính
- Python
- Star
- 283
- Fork
- 679
- Merge trung bình
- 7 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 3
Mô tả
### Is there an existing issue for this?
- [x] I have searched the existing issues
### What happened?
**_After visiting a person's face cluster view, the Home page incorrectly shows only that cluster’s images instead of the entire gallery._**
**Current Behavior**
1. Home page loads full gallery (e.g., 100 images).
2. Navigate to /person/ → shows cluster images (e.g., 5).
3. Navigate back to Home (browser back or navbar).
4. Home gallery now incorrectly shows only those 5 images.
5. A hard refresh is required to restore the full gallery.
**Expected Behavior**
Home should always display the complete image gallery, regardless of previous navigation.
**Root Cause**
**File: frontend/src/components/PersonImages.tsx**
In the success handler, the component dispatches:
dispatch(setImages(images)); // Overwrites global image list
This updates the global Redux images slice, which is also used by:
_Home page gallery
Search results
Any component depending on the main image list_
Since global state isn’t refetched when leaving the Person view, stale data persists across navigation.
**Impact**
1. Home gallery shows incomplete results
2. Search or other views using the global image list may be incorrect
3. Requires hard page refresh to recover
4. Person-specific view pollutes global application state
**Proposed Solution**
**Recommended:** _Create a dedicated Redux slice for cluster-specific images_
**Example:**
clusterImagesSlice
├── state: { images: [], loading, error }
├── actions: setClusterImages(), clearClusterImages()
**Benefits:**
1. Separates global gallery state from cluster-specific state
2. No side effects on Home or Search
3. Follows Redux best practices
4. Scalable for future filtered views (albums, tags, etc.)
5. View cleanup prevents stale data leaks
**I can open a PR implementing this slice along with tests.**
### Record
- [x] I agree to follow this project's Code of Conduct
### Checklist before Submitting
- [ ] Have you updated docs for it?
- [x] Have you added unit tests?
- [x] Have you made sure unit tests pass?
- [x] Have you made sure code formatting is correct?
- [x] Do Your changes passes all tests?
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.