diff --git a/web/apps/photos/src/components/FileList.tsx b/web/apps/photos/src/components/FileList.tsx index 7e9415652d..367fea4b2d 100644 --- a/web/apps/photos/src/components/FileList.tsx +++ b/web/apps/photos/src/components/FileList.tsx @@ -677,10 +677,10 @@ export const FileList: React.FC = ({ useEffect(() => { // Nothing to do here if nothing is selected. - if (!galleryContext.selectedFile) return; + if (!selected) return; const notSelectedFiles = (annotatedFiles ?? []).filter( - (item) => !galleryContext.selectedFile[item.file.id], + (item) => !selected[item.file.id], ); const unselectedDates = new Set( @@ -706,7 +706,7 @@ export const FileList: React.FC = ({ localSelectedDates.forEach((date) => checked.add(date)); return checked; }); - }, [galleryContext.selectedFile]); + }, [selected]); const handleSelectMulti = handleSelectCreatorMulti( setSelected, @@ -847,9 +847,7 @@ export const FileList: React.FC = ({ listItem: TimeStampListItem, isScrolling: boolean, ) => { - // Enhancement: This logic doesn't work on the shared album screen, the - // galleryContext.selectedFile is always null there. - const haveSelection = (galleryContext.selectedFile?.count ?? 0) > 0; + const haveSelection = (selected.count ?? 0) > 0; switch (listItem.tag) { case "date": return listItem.dates ? ( diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx index cfb19d646a..edf969fc0a 100644 --- a/web/apps/photos/src/pages/gallery.tsx +++ b/web/apps/photos/src/pages/gallery.tsx @@ -135,7 +135,6 @@ const defaultGalleryContext: GalleryContextType = { user: null, userIDToEmailMap: null, emailList: null, - selectedFile: null, }; export const GalleryContext = createContext( @@ -881,7 +880,6 @@ const Page: React.FC = () => { // TODO(RE): Rename userIDToEmailMap: state.emailByUserID, emailList: state.shareSuggestionEmails, - selectedFile: selected, }} > ; emailList: string[]; - selectedFile: SelectedState; }