Skip to content

armgit / ente

Public Imported from GitHub
0

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

Workaround

Manav Rathi349ef3263c2e
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index 0b2d6887ed..9d32737208 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -288,8 +288,17 @@ const FileViewer: React.FC<FileViewerProps> = ({
const handleDelete = async () => {
const file = activeAnnotatedFile!.file;
await onDelete(file);
- // TODO(PS): Update the viewer
- // updateItems(items.filter((item) => item.id !== file.id));
+ // TODO: We currently have a setTimeout to ensure that the updated
+ // `files` prop has made its way to us delegate before we query for the
+ // status again.
+ //
+ // See: [Note: File viewer action setTimeout TODO]
+ await new Promise((r) => setTimeout(r, 100));
+ // Refreshing the current slide after the current file has gone will
+ // show the subsequent slide (since that will move down to the current
+ // index). TODO: What if it's the last file?
+ psRef.current!.refreshCurrentSlideContent();
+
handleNeedsRemoteSync();
};
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index 87e72949c8..a67469df61 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -524,6 +524,8 @@ export class FileViewerPhotoSwipe {
this.pendingFavoriteUpdates.add(af.file.id);
buttonElement.disabled = true;
await delegate.toggleFavorite(af);
+ // [Note: File viewer action setTimeout TODO]
+ //
// TODO: This can be improved in two ways:
//
// 1. We currently have a setTimeout to ensure that the
@@ -537,8 +539,9 @@ export class FileViewerPhotoSwipe {
// 2. We reload the entire slide instead of just updating
// the button state. This is because there are two
// buttons, instead of a single button toggling between
- // two states (e.g. like the zoom button). A single
- // button can be achieved by moving the fill as a layer.
+ // two states (e.g. like the zoom button). This aspect is
+ // easier to improve: A single button can be achieved by
+ // moving the fill as a layer.
await new Promise((r) => setTimeout(r, 100));
this.pendingFavoriteUpdates.delete(af.file.id);
this.refreshCurrentSlideContent();