I am attempting to create a trending feature in my app.
Current approach:
I have a ranking
child for each post in the explore timeline which is constantly updated on users phones when they view, or like.
ExploreTimeline
post1
ranking: 117117117
timestamp: 32930.489349
On the explore I would then fetch the 10 highest ranked posts, when the user reaches a certain point after scrolling I paginate and fetch the next 10 highest Ending at the last ranking value.
PROBLEM
If while a user is on the explore, the ranking for the last postRanking changes, well then the next pagination will be messed up (In my testing it duplicates many posts).
How can I change my strategy to avoid this problem? Or what is a fix?