I have a list of items that each have a trash can beside them(ie delete button). Since there are so many possible results I display 25 results and then page the rest(when a user clicks the next page button at this time I get the next results).
However the problem that I am facing is once they delete a item, if there are still items in the database I want to retrieve their next item.
So 30 items belong to this user, they see 25 and if they delete one, the next item(item 26) gets pulled from the database and shown.
I don't think this would be hard to achieve the problem happens if they want to delete 5 items and click each after each other, I am scared a race condition will happen and instead of pulling item26, item27,item28,item29,item30, it may pull item26 x 5.
The only idea I can come up with is that I pull more than I show, if I show 25 records I pull 35 records and then keep refilling that bucket after each one gets deleted.
However I not sure how I would replenish the bucket of extras and scenarios on how to handle if there is not enough items to replenish the bucket.
I am using Reactjs, Mobx and Mobx State Tree.
I don't have any code yet as I no clue which way to go yet.
This is what I Would do: