I used to believe infinite scroll was one of the simplest features to implement.
Fetch data → append to a list → load more on scroll.
Easy, right?
That’s exactly how most tutorials show it.
And honestly… it works.
Until it doesn’t.
The Bug That Changed Everything
One bug completely changed how I think about infinite scroll.
A user changed a filter → the list reset → new data loaded.
Everything looked correct.
Then a couple of seconds later…
the old results came back and overwrote the new ones.
No errors. No warnings.
Just silently broken UI.
What actually happened?
A slow request from the previous state finished late and updated the UI with stale data.
That was the moment I realized:
Infinite scroll doesn’t break in demos.It breaks with real users, real timing, and real networks.
Where Things Start Falling Apart
After that, I started noticing the same issues again and again:
Stale requests overwriting fresh data after reset
Retry logic fetching the wrong page
IntersectionObserver…