Skip to content

Commit fd0965e

Browse files
committed
fix(pagination): moved signal update inside useTask
1 parent cf9e79e commit fd0965e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

packages/kit-headless/src/components/pagination/pagination.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,16 @@ export const Pagination = component$<PaginationProps>(
4949
}) => {
5050
const visibleItems = useSignal<(string | number)[]>([]);
5151

52-
visibleItems.value = usePagination(
53-
totalPages,
54-
selectedPage,
55-
siblingCount,
56-
boundaryCount,
57-
);
52+
useTask$(({ track }) => {
53+
track(() => [selectedPage, totalPages, siblingCount, boundaryCount]);
54+
55+
visibleItems.value = usePagination(
56+
totalPages,
57+
selectedPage,
58+
siblingCount,
59+
boundaryCount,
60+
);
61+
});
5862

5963
const isPrevButtonVisible = () => !hidePrevButton && selectedPage > 1;
6064
const isNextButtonVisible = () => !hideNextButton && selectedPage !== totalPages;

0 commit comments

Comments
 (0)