Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix(photos): preserve explicit album group collapse

AswinAsokcc43138ea865
diff --git a/web/apps/photos/src/components/gallery/BarImpl.tsx b/web/apps/photos/src/components/gallery/BarImpl.tsx
index 03fc1e301c..1b77206b2a 100644
--- a/web/apps/photos/src/components/gallery/BarImpl.tsx
+++ b/web/apps/photos/src/components/gallery/BarImpl.tsx
@@ -149,6 +149,7 @@ export const GalleryBarImpl: React.FC<GalleryBarImplProps> = ({
const [expandedAlbumFilter, setExpandedAlbumFilter] = useState<
AlbumFilter | undefined
>(albumFilter);
+ const lastAlbumFilter = useRef(albumFilter);
const displayedAlbumFilter =
isSearching &&
expandedAlbumFilter !== undefined &&
@@ -168,6 +169,9 @@ export const GalleryBarImpl: React.FC<GalleryBarImplProps> = ({
);
useEffect(() => {
+ // Heading clicks already set expansion; sync other group navigation.
+ if (lastAlbumFilter.current == albumFilter) return;
+ lastAlbumFilter.current = albumFilter;
setExpandedAlbumFilter(albumFilter);
}, [albumFilter]);
useEffect(() => {
@@ -569,6 +573,7 @@ export const GalleryBarImpl: React.FC<GalleryBarImplProps> = ({
: undefined
}
onClick={() => {
+ lastAlbumFilter.current = filter.value;
setExpandedAlbumFilter(
displayedAlbumFilter == filter.value
? undefined