File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export const createPageStore = ({
36
36
37
37
const pageIndex = writable ( initialPageIndex ) ;
38
38
39
- function calcPageCount ( [ $pageSize , $itemsCount ] : [ $pageSize : number , $itemsCount : number ] ) {
39
+ function calcPageCountAndLimitIndex ( [ $pageSize , $itemsCount ] : [ $pageSize : number , $itemsCount : number ] ) {
40
40
const $pageCount = Math . ceil ( $itemsCount / $pageSize ) ;
41
41
pageIndex . update ( ( $pageIndex ) => {
42
42
if ( $pageCount > 0 && $pageIndex >= $pageCount ) {
@@ -50,10 +50,10 @@ export const createPageStore = ({
50
50
const serverItemsCount = writable ( 0 ) ;
51
51
let pageCount ;
52
52
if ( serverSide ) {
53
- pageCount = derived ( [ pageSize , serverItemsCount ] , calcPageCount ) ;
53
+ pageCount = derived ( [ pageSize , serverItemsCount ] , calcPageCountAndLimitIndex ) ;
54
54
} else {
55
55
const itemCount = derived ( items , ( $items ) => $items . length ) ;
56
- pageCount = derived ( [ pageSize , itemCount ] , calcPageCount ) ;
56
+ pageCount = derived ( [ pageSize , itemCount ] , calcPageCountAndLimitIndex ) ;
57
57
}
58
58
59
59
const hasPreviousPage = derived ( pageIndex , ( $pageIndex ) => {
You can’t perform that action at this time.
0 commit comments