π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web] Reflect deletes in search result
Manav Rathiddc953045b40
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.tsindex b83dff05b5..7ec357511b 100644--- a/web/packages/new/photos/components/gallery/reducer.ts+++ b/web/packages/new/photos/components/gallery/reducer.ts@@ -1214,7 +1214,12 @@ const derivePeopleView = (*/const stateByUpdatingFilteredFiles = (state: GalleryState) => {if (state.isInSearchMode) {- const filteredFiles = state.searchResults ?? state.filteredFiles;+ const filteredFiles = deriveSearchFilteredFiles(+ state.searchResults,+ state.filteredFiles,+ state.trashedFiles,+ state.tempDeletedFileIDs,+ );return { ...state, filteredFiles };} else if (state.view?.type == "albums") {const filteredFiles = deriveAlbumsFilteredFiles(@@ -1306,6 +1311,32 @@ const deriveAlbumsFilteredFiles = (return sortAndUniqueFilteredFiles(filteredFiles, view.activeCollection);};+/**+ * Compute the sorted list of files to show when we're showing search results+ * and dependencies change.+ */+const deriveSearchFilteredFiles = (+ searchResults: GalleryState["searchResults"],+ filteredFiles: GalleryState["filteredFiles"],+ trashedFiles: GalleryState["trashedFiles"],+ tempDeletedFileIDs: GalleryState["tempDeletedFileIDs"],+) => {+ const baseResults = searchResults ?? filteredFiles;++ // The user might deleted files in the search results view itself. The+ // search results in such cases will continue showing already deleted files.+ // This'll get fixed the next time the search results are refreshed, but+ // meanwhile prune deleted files from the active search results.++ const trashedFilesSet = new Set(trashedFiles.map(({ id }) => id));++ return baseResults.filter((file) => {+ if (tempDeletedFileIDs.has(file.id)) return false;+ if (trashedFilesSet.has(file.id)) return false;+ return true;+ });+};+/*** Compute the sorted list of files to show when we're in the "hidden-albums"* view and the dependencies change.