diff --git a/packages/components/pagination/src/use-pagination.ts b/packages/components/pagination/src/use-pagination.ts index c9fd5d653a..0b7b052694 100644 --- a/packages/components/pagination/src/use-pagination.ts +++ b/packages/components/pagination/src/use-pagination.ts @@ -201,7 +201,6 @@ export function usePagination(originalProps: UsePaginationProps) { if (skipAnimation) { cursorRef.current.setAttribute("data-moving", "false"); cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1)`; - return; } @@ -212,13 +211,10 @@ export function usePagination(originalProps: UsePaginationProps) { cursorTimer.current = setTimeout(() => { // reset the scale of the cursor if (cursorRef.current) { + cursorRef.current.setAttribute("data-moving", "false"); cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1)`; } - cursorTimer.current = setTimeout(() => { - // remove the data-moving attribute - cursorRef.current?.setAttribute("data-moving", "false"); - cursorTimer.current && clearTimeout(cursorTimer.current); - }, CURSOR_TRANSITION_TIMEOUT); + cursorTimer.current && clearTimeout(cursorTimer.current); }, CURSOR_TRANSITION_TIMEOUT); } @@ -233,7 +229,6 @@ export function usePagination(originalProps: UsePaginationProps) { }); const activePageRef = useRef(activePage); - useEffect(() => { if (activePage && !originalProps.disableAnimation) { scrollTo(activePage, activePage === activePageRef.current);