Skip to content

armgit / ente

Public Imported from GitHub
0

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

Lint

Manav Rathi54b9661ddc2e
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 0ef8501047..e0e25e98c6 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -1149,7 +1149,9 @@ const Page: React.FC = () => {
onMarkTempDeleted={handleMarkTempDeleted}
onSetOpenFileViewer={setIsFileViewerOpen}
onSyncWithRemote={syncWithRemote}
- onFileAndCollectionSyncWithRemote={fileAndCollectionSyncWithRemote}
+ onFileAndCollectionSyncWithRemote={
+ fileAndCollectionSyncWithRemote
+ }
onVisualFeedback={handleVisualFeedback}
onSelectCollection={handleSelectCollection}
onSelectPerson={handleSelectPerson}
diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsx
index d8d67639eb..1d891e0b81 100644
--- a/web/packages/gallery/components/FileInfo.tsx
+++ b/web/packages/gallery/components/FileInfo.tsx
@@ -158,7 +158,7 @@ export type FileInfoProps = ModalVisibilityProps & {
* reflected locally. Until the promise settles the UI element that
* triggered the change will show an activity indicator to the user.
*/
- onFileMetadataUpdate: () => Promise<void>;
+ onFileMetadataUpdate?: () => Promise<void>;
/**
* Called when an action on the file info drawer change the caption of the
* given {@link EnteFile}.
@@ -595,7 +595,7 @@ const Caption: React.FC<CaptionProps> = ({
setIsSaving(true);
try {
await updateFileCaption(file, newCaption);
- await onFileMetadataUpdate();
+ await onFileMetadataUpdate?.();
onUpdateCaption(file.id, newCaption);
setIsSaving(false);
onClose();
@@ -703,7 +703,7 @@ const CreationTime: React.FC<CreationTimeProps> = ({
// offset, but right now it is not even surfaced, so don't also
// potentially overwrite it.
await updateFilePublicMagicMetadata(file, { dateTime, editedTime });
- await onFileMetadataUpdate();
+ await onFileMetadataUpdate?.();
} catch (e) {
onGenericError(e);
}
@@ -754,7 +754,7 @@ const FileName: React.FC<FileNameProps> = ({
const handleRename = async (newFileName: string) => {
await updateFileFileName(file, newFileName);
- await onFileMetadataUpdate();
+ await onFileMetadataUpdate?.();
};
const icon =
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index e0cd288ccd..baa10f24d5 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -226,7 +226,7 @@ export type FileViewerProps = ModalVisibilityProps & {
*
* See: [Note: Full sync vs file and collection sync]
*/
- onFileAndCollectionSyncWithRemote: () => Promise<void>;
+ onFileAndCollectionSyncWithRemote?: () => Promise<void>;
/**
* Called when the user performs an action which does not otherwise have any
* immediate visual impact, to acknowledge it.
@@ -850,11 +850,15 @@ export const FileViewer: React.FC<FileViewerProps> = ({
handleMore,
]);
- const handleFileMetadataUpdate = useCallback(async () => {
- // Wait for the file and collection sync to complete.
- await onFileAndCollectionSyncWithRemote();
- // Set the flag to trigger the full sync to later.
- handleNeedsRemoteSync();
+ const handleFileMetadataUpdate = useMemo(() => {
+ return onFileAndCollectionSyncWithRemote
+ ? async () => {
+ // Wait for the file and collection sync to complete.
+ await onFileAndCollectionSyncWithRemote();
+ // Set the flag to trigger the full sync to later.
+ handleNeedsRemoteSync();
+ }
+ : undefined;
}, [onFileAndCollectionSyncWithRemote, handleNeedsRemoteSync]);
const handleUpdateCaption = useCallback(