Skip to content

Commit

Permalink
fix(pagination): remove totalPages and add hasMore flags to pagination
Browse files Browse the repository at this point in the history
This is a clear indication of if there is more data to load. `totalPages` is removed as it suggests specific pages which is confusing when using cursor approach
  • Loading branch information
dtfiedler committed Jul 11, 2024
1 parent a0cad36 commit fbca746
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ function utils.paginateTableWithCursor(tableArray, cursor, cursorField, limit, s
items = items,
limit = limit,
totalItems = #sortedTable,
totalPages = math.ceil(#sortedTable / limit),
sortBy = sortBy,
sortOrder = sortOrder,
nextCursor = nextCursor,
hasMore = nextCursor ~= nil,
}
end

Expand Down

0 comments on commit fbca746

Please sign in to comment.