Skip to content

armgit / ente

Public Imported from GitHub
0

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

T

Manav Rathi4a7d849d94e6
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 046572e25d..2c7a8611fc 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -21,6 +21,7 @@ import {
} from "@/new/photos/components/gallery";
import {
deriveFilteredFilesAlbumishFocus,
+ deriveFilteredFilesTrash,
uniqueFilesByID,
useGalleryReducer,
type GalleryBarMode,
@@ -556,10 +557,7 @@ export default function Gallery() {
people: filteredVisiblePeople,
};
} else if (activeCollectionID === TRASH_SECTION) {
- filteredFiles = uniqueFilesByID([
- ...trashedFiles,
- ...files.filter((file) => tempDeletedFileIDs?.has(file.id)),
- ]);
+ filteredFiles = deriveFilteredFilesTrash(state);
} else {
filteredFiles = deriveFilteredFilesAlbumishFocus(state);
}
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.ts
index c40ce487f7..9de93e353a 100644
--- a/web/packages/new/photos/components/gallery/reducer.ts
+++ b/web/packages/new/photos/components/gallery/reducer.ts
@@ -1008,6 +1008,20 @@ export const deriveFilteredFilesAlbumFocus = (state: GalleryState) => {
return sortAndUniqueFilteredFiles(filteredFiles, activeCollection);
};
+/**
+ * Helper function to compute the sorted list of files to show when we're
+ * showing the "Trash".
+ */
+export const deriveFilteredFilesTrash = ({
+ files,
+ trashedFiles,
+ tempDeletedFileIDs,
+}: GalleryState) =>
+ uniqueFilesByID([
+ ...trashedFiles,
+ ...files.filter((file) => tempDeletedFileIDs.has(file.id)),
+ ]);
+
/**
* Helper function to compute the sorted list of files to show when we're
* in the "hidden-albums" focus.