diff --git a/frontend/src/features/gallery/store/gallerySlice.ts b/frontend/src/features/gallery/store/gallerySlice.ts index c3632bedd8..901a58e124 100644 --- a/frontend/src/features/gallery/store/gallerySlice.ts +++ b/frontend/src/features/gallery/store/gallerySlice.ts @@ -174,7 +174,7 @@ export const gallerySlice = createSlice({ const currentImageIndex = tempImages.findIndex( (i) => i.uuid === currentImage.uuid ); - if (_.inRange(currentImageIndex, 0, tempImages.length - 1)) { + if (currentImageIndex < tempImages.length - 1) { const newCurrentImage = tempImages[currentImageIndex + 1]; state.currentImage = newCurrentImage; state.currentImageUuid = newCurrentImage.uuid; @@ -191,7 +191,7 @@ export const gallerySlice = createSlice({ const currentImageIndex = tempImages.findIndex( (i) => i.uuid === currentImage.uuid ); - if (_.inRange(currentImageIndex, 1, tempImages.length + 1)) { + if (currentImageIndex > 0) { const newCurrentImage = tempImages[currentImageIndex - 1]; state.currentImage = newCurrentImage; state.currentImageUuid = newCurrentImage.uuid;