fix: paginated list history headings were not rendering when there was only one unique heading (#3496)
* fix: paginated list history headings were not rendering when there was only one unique heading * minor bug
This commit is contained in:
@@ -119,7 +119,7 @@ class PaginatedList<T extends PaginatedItem> extends React.Component<Props<T>> {
|
||||
// of lazy rendering then show another page.
|
||||
const leftToRender = (this.props.items?.length ?? 0) - this.renderCount;
|
||||
|
||||
if (leftToRender > 1) {
|
||||
if (leftToRender > 0) {
|
||||
this.renderCount += DEFAULT_PAGINATION_LIMIT;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,6 @@ class PaginatedList<T extends PaginatedItem> extends React.Component<Props<T>> {
|
||||
renderHeading,
|
||||
onEscape,
|
||||
} = this.props;
|
||||
let previousHeading = "";
|
||||
|
||||
const showLoading =
|
||||
this.isFetching &&
|
||||
@@ -168,8 +167,9 @@ class PaginatedList<T extends PaginatedItem> extends React.Component<Props<T>> {
|
||||
aria-label={this.props["aria-label"]}
|
||||
onEscape={onEscape}
|
||||
>
|
||||
{(composite: CompositeStateReturn) =>
|
||||
items.slice(0, this.renderCount).map((item, index) => {
|
||||
{(composite: CompositeStateReturn) => {
|
||||
let previousHeading = "";
|
||||
return items.slice(0, this.renderCount).map((item, index) => {
|
||||
const children = this.props.renderItem(item, index, composite);
|
||||
|
||||
// If there is no renderHeading method passed then no date
|
||||
@@ -202,8 +202,8 @@ class PaginatedList<T extends PaginatedItem> extends React.Component<Props<T>> {
|
||||
}
|
||||
|
||||
return children;
|
||||
})
|
||||
}
|
||||
});
|
||||
}}
|
||||
</ArrowKeyNavigation>
|
||||
{this.allowLoadMore && (
|
||||
<Waypoint key={this.renderCount} onEnter={this.loadMoreResults} />
|
||||
|
||||
Reference in New Issue
Block a user