Fork me on GitHub
#re-frame
<
2016-09-12
>
conaw16:09:59

Question: what would be the most efficient way to implement infinite scroll in a re-frame app? As in, say one was building a feed, like Twitter or Facebook, and initially you wanted to only render some 20 or so updates, the rest would be loaded in lazily as the user scrolled down. You'd want fresh updates to appear at the top, but not displace the oldest loaded item. Dynamic subscription?

conaw16:09:44

This gist from @nberger answers a part of the challenge — https://gist.github.com/nberger/b5e316a43ffc3b7d5e084b228bd83899 I’m just curious what the cleanest app-state would look like for a feed.

jakemcc18:09:17

@conaw my project has something similar in shape to that code sample but instead of calling a function it dispatches an event. The event triggers a request to our server and the processing of the response to that request ends up adding more things to a list of elements in our app state. The element that renders our grid has a subscription that returns that list of things