This commit is contained in:
seb
2026-10-10 02:37:41 +02:00
parent 6e23c34bd3
commit bc49139b1e
4 changed files with 96 additions and 148 deletions

View File

@@ -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);