diff --git a/packages/dnb-eufemia/src/components/pagination/Pagination.js b/packages/dnb-eufemia/src/components/pagination/Pagination.js index bb918102034..05f9c69ef48 100644 --- a/packages/dnb-eufemia/src/components/pagination/Pagination.js +++ b/packages/dnb-eufemia/src/components/pagination/Pagination.js @@ -96,11 +96,7 @@ const paginationPropTypes = { class: PropTypes.string, className: PropTypes.string, - children: PropTypes.oneOfType([ - // PropTypes.array, - PropTypes.node, - PropTypes.func, - ]), + children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), on_change: PropTypes.func, on_startup: PropTypes.func, diff --git a/packages/dnb-eufemia/src/components/pagination/PaginationInfinity.js b/packages/dnb-eufemia/src/components/pagination/PaginationInfinity.js index 587689747fa..8f3c61bfb9c 100644 --- a/packages/dnb-eufemia/src/components/pagination/PaginationInfinity.js +++ b/packages/dnb-eufemia/src/components/pagination/PaginationInfinity.js @@ -72,6 +72,11 @@ export default class InfinityScroller extends React.PureComponent { ) => { const { pageCount, endInfinity } = this.context.pagination + console.log('InfinityScroller: getNewContent', { + newPageNo, + pageCount, + }) + // if "page_count" is set do not load more than that value if (newPageNo > pageCount) { return endInfinity() @@ -200,6 +205,18 @@ export default class InfinityScroller extends React.PureComponent { indicator_element, } = this.context.pagination + console.log('InfinityScroller: render', { + // our states + lowerPage, + upperPage, + pageCount, + hasEndedInfinity, + parallelLoadCount, + + // our props + current_page, + }) + const Marker = () => ( 0)) { clearTimeout(this._startupTimeout) @@ -291,6 +310,11 @@ export default class InfinityScroller extends React.PureComponent { return null // stop here } + console.log( + 'InfinityScroller: useMarkerOnly', + this.context.pagination.useMarkerOnly + ) + if (this.context.pagination.useMarkerOnly) { return this.handleInfinityMarker() } diff --git a/packages/dnb-eufemia/src/components/pagination/PaginationProvider.js b/packages/dnb-eufemia/src/components/pagination/PaginationProvider.js index f51132932d1..10ce3b0da44 100644 --- a/packages/dnb-eufemia/src/components/pagination/PaginationProvider.js +++ b/packages/dnb-eufemia/src/components/pagination/PaginationProvider.js @@ -106,7 +106,7 @@ export default class PaginationProvider extends React.PureComponent { // only used by handleInfinityMarker if (props.useMarkerOnly) { if (typeof state.lowerPage === 'undefined') { - state.lowerPage = state.startupPage + state.lowerPage = state.startupPage || 1 } const cur = parseFloat(props.current_page) if (!isNaN(cur) && cur < state.lowerPage) { @@ -114,8 +114,11 @@ export default class PaginationProvider extends React.PureComponent { } if (typeof state.upperPage === 'undefined') { state.upperPage = - state.startupPage + parseFloat(props.startup_count) - 1 + state.startupPage + (parseFloat(props.startup_count) || 1) - 1 || + 1 } + console.log('InfinityScroller: lowerPage', state.lowerPage) + console.log('InfinityScroller: upperPage', state.upperPage) } // reset content, like the resetContent method @@ -288,6 +291,8 @@ export default class PaginationProvider extends React.PureComponent { } endInfinity = () => { + console.log('InfinityScroller: endInfinity') + this.setState( { hasEndedInfinity: true,