Skip to content

Conversation

@marcodejongh
Copy link
Owner

The infinite scroll trigger was broken because hasMoreResults returned
undefined (falsy) when SWR data hadn't loaded yet. This prevented the
InfiniteScroll component from triggering the next fetch.

When using SSR initialClimbs, the client-side SWR fetch hasn't completed
yet, so hasMoreResults was undefined. Now it defaults to true until
we have actual data to determine the correct value.

@vercel
Copy link

vercel bot commented Dec 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
boardsesh Ready Ready Preview, Comment Dec 25, 2025 10:30am

The infinite scroll trigger was broken because hasMoreResults returned
undefined (falsy) when SWR data hadn't loaded yet. This prevented the
InfiniteScroll component from triggering the next fetch.

Now hasMoreResults defaults to true while isFetchingClimbs is true
(so infinite scroll works during SSR hydration), and false after loading
completes with no data.
The CSS rule setting overflow-x: hidden on .ant-layout-content was
interfering with the scroll detection for react-infinite-scroll-component.
The scroll container (#content-for-scrollable) has its overflow properties
set via inline styles, which should be the source of truth.

Removing this CSS rule allows the InfiniteScroll component to properly
detect scroll events and trigger loading more climbs.
Add useEffect to manually trigger fetchMoreClimbs when the initial content
doesn't fill the scroll container. This handles the case where
react-infinite-scroll-component's auto-detection doesn't work properly
because there's no scrollbar to trigger scroll events.
Uses a ref to track when fetching completes, then checks if the scroll
container needs more content. This avoids timeouts and only triggers
after each fetch completes or on initial mount.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants