TanStackT
TanStack2y ago
7 replies
ripe-gray

Infinite scroll with duplicate data?

I'm building a React Native app with infinite scroll but I have concerns about duplicate data.

Say we are currently on "page 5" of our query, and each "page" has 10 elements, we currently have elements 40-50.

If the user waited on this screen for a few hours, and didn't do anything, and in the meantime, other users made a bunch of posts to a newsfeed, when our user scrolls down, triggering page 6, won't the API return elements we've already seen? Since new posts were made, they all the posts down.

This would result in duplicate posts getting rendered in our list.
Was this page helpful?