From 2bc9251a09f665954efcb95ae006338defe9ce85 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Thu, 2 Jan 2025 16:36:52 +0530 Subject: [PATCH] Specific --- .../src/components/PhotoViewer/index.tsx | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/web/apps/photos/src/components/PhotoViewer/index.tsx b/web/apps/photos/src/components/PhotoViewer/index.tsx index 4023821fd9..845e689152 100644 --- a/web/apps/photos/src/components/PhotoViewer/index.tsx +++ b/web/apps/photos/src/components/PhotoViewer/index.tsx @@ -121,6 +121,7 @@ export const PhotoViewer: React.FC = (props) => { items, currentIndex, onClose, + gettingData, forceConvertItem, favoriteFileIDs, markUnsyncedFavoriteUpdate, @@ -436,23 +437,11 @@ export const PhotoViewer: React.FC = (props) => { items, options, ); - photoSwipeV4Events.forEach((event) => { - const callback = props[event]; - if (callback || event === "destroy") { - photoSwipe.listen(event, function (...args) { - if (callback) { - args.unshift(photoSwipe); - callback(...args); - } - if (event === "destroy") { - handleClose(); - } - if (event === "close") { - handleClose(); - } - }); - } - }); + + photoSwipe.listen("destroy", handleClose); + photoSwipe.listen("gettingData", (index, item) => + gettingData(photoSwipe, index, item as EnteFile), + ); photoSwipe.listen("beforeChange", () => { if (!photoSwipe?.currItem) return; const currItem = photoSwipe.currItem as EnteFile;