Skip to content

Commit

Permalink
Change the callback to respond on programs page as well (#2111)
Browse files Browse the repository at this point in the history
* Smaller callback change to facilitate things loading quicklier

* fix duplication of last item
  • Loading branch information
JenniWhitman authored Feb 22, 2024
1 parent 5c3be0d commit 3efbb11
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frontend/public/src/containers/pages/CatalogPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class CatalogPage extends React.Component<Props> {
}
} else {
const { getNextProgramPage, programsNextPage } = this.props
if (programsNextPage) {
if (programsNextPage && !this.state.isLoadingMoreItems) {
this.setState({ isLoadingMoreItems: true })
const response = await getNextProgramPage(
this.state.programQueryPage + 1
Expand Down Expand Up @@ -202,6 +202,12 @@ export class CatalogPage extends React.Component<Props> {
this.setState({
filteredPrograms: filteredPrograms
})
// Detect when the bottom of the catalog page has been reached and display more catalog items.
this.io = new window.IntersectionObserver(
this.bottomOfLoadedCatalogCallback,
{ threshold: 1.0 }
)
this.io.observe(this.container.current)
}
}

Expand Down

0 comments on commit 3efbb11

Please sign in to comment.