diff --git a/ui/v2.5/src/components/Scenes/SceneMarkerWallPanel.tsx b/ui/v2.5/src/components/Scenes/SceneMarkerWallPanel.tsx index 5883bbed79..a081baf6aa 100644 --- a/ui/v2.5/src/components/Scenes/SceneMarkerWallPanel.tsx +++ b/ui/v2.5/src/components/Scenes/SceneMarkerWallPanel.tsx @@ -243,9 +243,15 @@ const MarkerWall: React.FC = ({ }); }, [markers, erroredImgs, handleError]); + // Guard against duplicate clicks - react-photo-gallery can dispatch + // the onClick handler twice for a single click event const onClick = useCallback( (event, { index }) => { - history.push(photos[index].link); + const link = photos[index].link; + const current = history.location.pathname + history.location.search; + if (current !== link) { + history.push(link); + } }, [history, photos] ); diff --git a/ui/v2.5/src/components/Scenes/SceneWallPanel.tsx b/ui/v2.5/src/components/Scenes/SceneWallPanel.tsx index f9a42dd489..fcb095c32e 100644 --- a/ui/v2.5/src/components/Scenes/SceneWallPanel.tsx +++ b/ui/v2.5/src/components/Scenes/SceneWallPanel.tsx @@ -258,9 +258,15 @@ const SceneWall: React.FC = ({ }); }, [scenes, sceneQueue, erroredImgs, handleError]); + // Guard against duplicate clicks - react-photo-gallery can dispatch + // the onClick handler twice for a single click event const onClick = useCallback( (event, { index }) => { - history.push(photos[index].link); + const link = photos[index].link; + const current = history.location.pathname + history.location.search; + if (current !== link) { + history.push(link); + } }, [history, photos] );