This commit is contained in:
speckofthecosmos 2026-05-05 14:45:53 +10:00 committed by GitHub
commit 32e7a1d3b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View file

@ -243,9 +243,15 @@ const MarkerWall: React.FC<IMarkerWallProps> = ({
});
}, [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]
);

View file

@ -258,9 +258,15 @@ const SceneWall: React.FC<ISceneWallProps> = ({
});
}, [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]
);