diff --git a/frontend/apps/artcraft/app/src/pages/PageImage/TextToImage.tsx b/frontend/apps/artcraft/app/src/pages/PageImage/TextToImage.tsx index ae005db46b..05ce4eaf0c 100644 --- a/frontend/apps/artcraft/app/src/pages/PageImage/TextToImage.tsx +++ b/frontend/apps/artcraft/app/src/pages/PageImage/TextToImage.tsx @@ -159,7 +159,13 @@ const TextToImage = ({ imageMediaId, imageUrl }: TextToImageProps) => { galleryModalLightboxNavPrev.value = batchIndex > 0 - ? () => openBatchInLightbox(inverseBatchRef.current[batchIndex - 1]) + ? () => { + const prevBatch = inverseBatchRef.current[batchIndex - 1]; + openBatchInLightbox( + prevBatch, + Math.max(0, prevBatch.images.length - 1), + ); + } : null; galleryModalLightboxNavNext.value = batchIndex < inverseBatchRef.current.length - 1