u
This commit is contained in:
@@ -260,13 +260,14 @@ class FillSpace extends Component {
|
||||
|
||||
// FillSpace owns current page, wheel-pagination and the pagination header.
|
||||
// Caller feeds `items` plus one row element via `renderItem` (component
|
||||
// type or callback).
|
||||
// type or callback). `items` may be undefined while data is loading.
|
||||
const { pageSize, currentPage, viewportHeight } = this.state;
|
||||
const total = items.length;
|
||||
const list = Array.isArray(items) ? items : [];
|
||||
const total = list.length;
|
||||
const pageCount = Math.max(1, Math.ceil(total / Math.max(1, pageSize)));
|
||||
const safePage = Math.min(Math.max(1, currentPage), pageCount);
|
||||
const offset = (safePage - 1) * pageSize;
|
||||
const pageItems = items.slice(offset, offset + pageSize);
|
||||
const pageItems = list.slice(offset, offset + pageSize);
|
||||
const showPagination = total > pageSize;
|
||||
// Hidden data-free probe: measures `renderItem` itself (no data).
|
||||
const probe = renderProbeElement(renderItem);
|
||||
|
||||
Reference in New Issue
Block a user