From ddc308aa4e5da482763f97e16ab92fe777e8dfeb Mon Sep 17 00:00:00 2001
From: FIN-IT_AndriFP <andrifebriyadiputra@gmail.com>
Date: Tue, 23 Dec 2025 14:48:48 +0700
Subject: (andri) fix scrolltoindex

---
 src-migrate/modules/product-detail/components/ProductDetail.tsx | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'src-migrate/modules/product-detail/components/ProductDetail.tsx')

diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx
index 1c9c39e0..82b99697 100644
--- a/src-migrate/modules/product-detail/components/ProductDetail.tsx
+++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx
@@ -312,10 +312,9 @@ const ProductDetail = ({ product }: Props) => {
   };
 
   const scrollToIndex = (i: number) => {
-    const el = sliderRef.current;
-    if (!el) return;
-    const elRef = sliderRef.current;
-    elRef.scrollTo({ left: i * elRef.clientWidth, behavior: 'smooth' });
+    const el = sliderRef.current; 
+    if (!el) return; 
+    el.scrollTo({ left: i * el.clientWidth, behavior: 'smooth' });
     setCurrentIdx(i);
     setMainImage(allImages[i] || '');
   };
-- 
cgit v1.2.3

