Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(photoSwipe):issue-fixed

Aswin Asokd9c72a1ad276
diff --git a/web/apps/photos/src/components/AlbumAddedNotification.tsx b/web/apps/photos/src/components/AlbumAddedNotification.tsx
index 050cb967ab..6cd3da79f7 100644
--- a/web/apps/photos/src/components/AlbumAddedNotification.tsx
+++ b/web/apps/photos/src/components/AlbumAddedNotification.tsx
@@ -74,8 +74,8 @@ export const AlbumAddedNotification: React.FC<AlbumAddedNotificationProps> = ({
{onArrowClick && (
<FilledIconButton
onClick={() => {
- onArrowClick();
onClose();
+ onArrowClick();
}}
>
<ArrowForwardIcon />
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index 1f1fc4a2d6..d025413d53 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -843,10 +843,13 @@ export const FileViewer: React.FC<FileViewerProps> = ({
if (!files.length) {
// If there are no more files left, close the viewer.
handleClose();
- } else {
+ } else if (open && activeAnnotatedFile) {
+ // Only refresh if the viewer is still open and we have an active file.
+ // This prevents race conditions when navigating away (e.g., when clicking
+ // the navigate button in AlbumAddedNotification while the viewer is open).
psRef.current?.refreshSlideOnFilesUpdateIfNeeded();
}
- }, [handleClose, files]);
+ }, [handleClose, files, open, activeAnnotatedFile]);
useEffect(() => {
// This effect might get triggered when the none of the files that were