Skip to content

Commit 8836e0f

Browse files
committed
rename calcPageCount function
1 parent b7bea62 commit 8836e0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib/plugins/addPagination.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const createPageStore = ({
3636

3737
const pageIndex = writable(initialPageIndex);
3838

39-
function calcPageCount([$pageSize, $itemsCount]: [$pageSize: number, $itemsCount: number]) {
39+
function calcPageCountAndLimitIndex([$pageSize, $itemsCount]: [$pageSize: number, $itemsCount: number]) {
4040
const $pageCount = Math.ceil($itemsCount / $pageSize);
4141
pageIndex.update(($pageIndex) => {
4242
if ($pageCount > 0 && $pageIndex >= $pageCount) {
@@ -50,10 +50,10 @@ export const createPageStore = ({
5050
const serverItemsCount = writable(0);
5151
let pageCount;
5252
if (serverSide) {
53-
pageCount = derived([pageSize, serverItemsCount], calcPageCount);
53+
pageCount = derived([pageSize, serverItemsCount], calcPageCountAndLimitIndex);
5454
} else {
5555
const itemCount = derived(items, ($items) => $items.length);
56-
pageCount = derived([pageSize, itemCount], calcPageCount);
56+
pageCount = derived([pageSize, itemCount], calcPageCountAndLimitIndex);
5757
}
5858

5959
const hasPreviousPage = derived(pageIndex, ($pageIndex) => {

0 commit comments

Comments
 (0)