lundi 5 avril 2021

The best way to design an infinite scroll list on backend

I'm trying to design a page that supports infinite scroll. There is 1 important feature that we definitely want this to support: we want to be able to update the already loaded items if an item is changed/deleted.

For example, imagine your Twitter homepage is loaded and one of the loaded tweets gets deleted. Our ideal list needs to be able to get updated with the changes.

The normal way I had in mind was to call a method such as loadTweets(pageNumber = 1) and as the user scrolls down, pageNumber increments and we make the API call again. But this will not support keeping track of already loaded items.

Aucun commentaire:

Enregistrer un commentaire