fix: stabilize Live Activity infinite scroll pagination#1056
Open
nickmopen wants to merge 2 commits into
Open
Conversation
- DashboardApi: use lastPageParam+1 in getNextPageParam instead of allPages.length+1, which could return a stale page number during background refetch cycles - LiveCommitLog: replace IntersectionObserver with a debounced scroll handler (120ms) that checks distance from bottom in fixed pixels. Adds fetchInFlightRef to prevent concurrent fetches. Removes sentinel DOM element.
anderdc
requested changes
May 15, 2026
Collaborator
anderdc
left a comment
There was a problem hiding this comment.
Three things to address before merge:
- src/pages/dashboard/views/LiveCommitLog.tsx: the scrollDebounceRef timeout is never cleared on unmount. Add a cleanup effect that clears the pending timeout.
- LiveCommitLog.tsx: the scroll handler only fires on a real scroll event, so if the first page doesn't fill the container there's nothing to trigger fetchNextPage and more pages can't load. Handle the not-scrollable case — the IntersectionObserver this replaces covered it automatically.
- PR body: "Fixes #685" will auto-close the issue on merge while Issue 2 (repo bar chart) is still unaddressed. Reference #685 without the closing keyword so it stays open for Issue 2.
…irst page doesn't fill the container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Live Activity infinite scroll on the Dashboard that would enter an endless loading loop when scrolling at a moderate pace.
Two root causes addressed for Issue 1:
DashboardApi:getNextPageParamwas usingallPages.length + 1to derive the next page number. During a backgroundrefetchIntervalrefetch,allPagesis rebuilt page-by-page and can be shorter than expected whengetNextPageParamis evaluated, causing a stale/incorrect page number to be requested. Changed tolastPageParam + 1which is always the canonical value.LiveCommitLog: TheIntersectionObserverhadisFetchingNextPageandvisibleEntries.lengthin its dependency array. Every time a page loaded, the effect would teardown and recreate the observer — which would immediately fire if the sentinel element was still in the viewport, bypassing the in-flight guard and triggering anotherfetchNextPage(). This created the infinite request loop. Replaced with a debounced scroll handler (120ms) that checks a fixed pixel distance from the bottom of the container, with afetchInFlightRefflag to prevent concurrent fetches. Removes the sentinel DOM element entirely.Related Issues
See #685 (Issue 1 only — Issue 2 not reproducible, no changes made)
Type of Change
Screenshots
before
Screen.Recording.2026-05-11.at.8.30.27.PM.mov
after
Screen.Recording.2026-05-11.at.8.29.46.PM.mov
Checklist
npm run formatandnpm run lint:fixhave been runnpm run buildpasses