Skip to content

armgit / ente

Public Imported from GitHub
0

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

Validate

Manav Rathif30e05389b22
diff --git a/web/apps/photos/src/components/PhotoFrame.tsx b/web/apps/photos/src/components/PhotoFrame.tsx
index 61300576c3..efbef014d4 100644
--- a/web/apps/photos/src/components/PhotoFrame.tsx
+++ b/web/apps/photos/src/components/PhotoFrame.tsx
@@ -235,6 +235,22 @@ const PhotoFrame = ({
}
}, [selected]);
+ console.log({ t: "PhotoFrame", open: open });
+
+ useEffect(() => {
+ if (process.env.NEXT_PUBLIC_ENTE_WIP_PS5) {
+ console.log({ t: "PhotoFrame UE", open: open5 });
+
+ setTimeout(() => {
+ setOpen5(false);
+ }, 5000);
+ }
+ return () => {
+ if (process.env.NEXT_PUBLIC_ENTE_WIP_PS5)
+ console.log({ t: "PhotoFrame UE cleanup", open: open5 });
+ };
+ }, [open5]);
+
if (!displayFiles) {
return <div />;
}
diff --git a/web/packages/new/photos/components/FileViewer5.tsx b/web/packages/new/photos/components/FileViewer5.tsx
index 6a9962e4c9..223c5108c8 100644
--- a/web/packages/new/photos/components/FileViewer5.tsx
+++ b/web/packages/new/photos/components/FileViewer5.tsx
@@ -94,19 +94,42 @@ const FileViewer: React.FC<FileViewerProps> = ({
};
});
pswp.on("close", () => {
- console.log("pswp.on(close)");
+ // The user did some action within the image viewer to close it. Let
+ // our parent component know that the image viewer is closing.
onClose();
});
pswpRef.current = pswp;
- // Initializing PhotoSwipe adds it to the DOM as a "dialog" div
- // with the class "pswp" (and others).
+ // Initializing PhotoSwipe adds it to the DOM as a dialog-like div with
+ // the class "pswp".
pswp.init();
return () => {
// Closing PhotoSwipe removes it from the DOM.
//
- // This will only have an effect if we're being closed externally.
+ // This will only have an effect if we're being closed externally
+ // (e.g. if the user selects an album in the file info). If this
+ // cleanup function is running because we were closed internally,
+ // then the PhotoSwipe code will no-op this extra close.
pswpRef.current?.close();
+ console.log({
+ "pswpRef.current": pswpRef.current,
+ "pswpRef.current.isOpen": pswpRef.current.isOpen,
+ "pswpRef.current.opener": pswpRef.current.opener,
+ "pswpRef.current.opener.isOpen": pswpRef.current.opener.isOpen,
+ "pswpRef.current.opener.isClosed":
+ pswpRef.current.opener.isClosed,
+ });
+ setTimeout(() => {
+ console.log({
+ "pswpRef.current": pswpRef.current,
+ "pswpRef.current.isOpen": pswpRef.current.isOpen,
+ "pswpRef.current.opener": pswpRef.current.opener,
+ "pswpRef.current.opener.isOpen":
+ pswpRef.current.opener.isOpen,
+ "pswpRef.current.opener.isClosed":
+ pswpRef.current.opener.isClosed,
+ });
+ }, 1000);
pswpRef.current = undefined;
};
}, [open]);