[SHOPTIME-3569] Top banner 좌우버튼 클릭이슈

원인 : 홈배너데이터 변경시 length 계산오류
대책 : last index계산 오류 수정
This commit is contained in:
yonghyon
2024-09-25 13:22:35 +09:00
parent 2d59da2afe
commit fdb15be1b0

View File

@@ -105,7 +105,7 @@ export default function RollingUnit({
const [startIndex, setStartIndex] = useState( const [startIndex, setStartIndex] = useState(
savedIndex !== undefined ? savedIndex : 0 savedIndex !== undefined ? savedIndex : 0
); );
const [lastIndex, setLastIndex] = useState(rollingDataLength - 1); const lastIndex = rollingDataLength - 1;
const [rollingFocus, setRollingFocus] = useState(false); const [rollingFocus, setRollingFocus] = useState(false);
const [contentsFocus, setContentsFocus] = useState(false); const [contentsFocus, setContentsFocus] = useState(false);
const [prevFocus, setPrevFocus] = useState(false); const [prevFocus, setPrevFocus] = useState(false);
@@ -222,7 +222,7 @@ export default function RollingUnit({
return; return;
} }
setStartIndex(startIndex + 1); setStartIndex(startIndex + 1);
}, [startIndex]); }, [startIndex, lastIndex]);
// 베너 포커스 인 // 베너 포커스 인
const onFocus = useCallback(() => { const onFocus = useCallback(() => {