π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Prevent rerenders
Manav Rathif3a079e73425
diff --git a/web/apps/photos/src/components/PhotoFrame.tsx b/web/apps/photos/src/components/PhotoFrame.tsxindex 2df66688ee..a60768019a 100644--- a/web/apps/photos/src/components/PhotoFrame.tsx+++ b/web/apps/photos/src/components/PhotoFrame.tsx@@ -285,12 +285,11 @@ const PhotoFrame = ({: undefined;}, [favoriteFileIDs, onMarkUnsyncedFavoriteUpdate]);- // TODO(PS): Missing dep!const handleDownload = useCallback((file: EnteFile) => {const setSingleFileDownloadProgress =setFilesDownloadProgressAttributesCreator!(file.metadata.title);void downloadSingleFile(file, setSingleFileDownloadProgress);- }, []);+ }, [setFilesDownloadProgressAttributesCreator]);const handleDelete = useMemo(() => {return onMarkTempDeleteddiff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex 79de4d7458..3fed596013 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -630,8 +630,8 @@ const Page: React.FC = () => {};const setFilesDownloadProgressAttributesCreator: SetFilesDownloadProgressAttributesCreator =- (folderName, collectionID, isHidden) => {- const id = filesDownloadProgressAttributesList?.length ?? 0;+ useCallback((folderName, collectionID, isHidden) => {+ const id = Math.random();const updater: SetFilesDownloadProgressAttributes = (value) => {setFilesDownloadProgressAttributesList((prev) => {const attributes = prev?.find((attr) => attr.id === id);@@ -660,7 +660,7 @@ const Page: React.FC = () => {downloadDirPath: null,});return updater;- };+ }, []);const collectionOpsHelper =(ops: COLLECTION_OPS_TYPE) => async (collection: Collection) => {diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsxindex 97a8374827..25812ee9a3 100644--- a/web/apps/photos/src/pages/shared-albums.tsx+++ b/web/apps/photos/src/pages/shared-albums.tsx@@ -124,8 +124,8 @@ export default function PublicCollectionGallery() {] = useState<FilesDownloadProgressAttributes[]>([]);const setFilesDownloadProgressAttributesCreator: SetFilesDownloadProgressAttributesCreator =- (folderName, collectionID, isHidden) => {- const id = filesDownloadProgressAttributesList?.length ?? 0;+ useCallback((folderName, collectionID, isHidden) => {+ const id = Math.random();const updater: SetFilesDownloadProgressAttributes = (value) => {setFilesDownloadProgressAttributesList((prev) => {const attributes = prev?.find((attr) => attr.id === id);@@ -154,7 +154,7 @@ export default function PublicCollectionGallery() {downloadDirPath: null,});return updater;- };+ }, []);const onAddPhotos = useMemo(() => {return publicCollection?.publicURLs?.[0]?.enableCollect