Hi! Does anybody know how to implement background ...
# compose
f
Hi! Does anybody know how to implement background data polling in paginated list without user knowing? I have a list using Paging3 that I display in Compose. Every N seconds I need to update this list (all loaded pages). After update there may be updated values in items or deleted/new items. This must be not visible to user (stay on scroll position). I have no idea how to make this possible
s
If you have something in your data layer polling and updating the information stored in your database, do you experience any loss of scroll position etc? What did you do so far which has or has not worked? The polling itself does not sound compose related really, that would be done somewhere else.
p
I was all ready to say to use a repository / cache layer with a flow, and then I saw the “pagination” requirement.
s
But the pagination source is still the database, is it not?
p
yes, it would work fine, but whether it would end up with a smooth UX, would depend slightly on the pagination structure - I can see this working well for alphabetic or category pagination, but would be awful for numeric pagination, unless very tightly controlled - e.g.new things always go on the end, and pages are fixed sizes, not fixed number of pages.