Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Posts Loading #22

Open
noushinquazi opened this issue Oct 22, 2018 · 3 comments
Open

Posts Loading #22

noushinquazi opened this issue Oct 22, 2018 · 3 comments
Assignees

Comments

@noushinquazi
Copy link
Contributor

Only load certain posts at a time-- recommended strategy is to keep track of what chunk of posts are currently loaded on frontend and ask the backend for x new posts when the user scrolls to the bottom of the currently loaded chunk.

@noushinquazi
Copy link
Contributor Author

noushinquazi commented Jan 31, 2019

goal: when user scrolls to bottom of post list, there is a trigger that leads to the app asking for x more posts. the app waits for these x posts to be added to the list before letting the user scroll further.

design choices to consider:

  • should there be an explicit "load more" button or should loading more posts be triggered implicitly ie. when the user hits the bottom of the posts.
  • how will the app keep track of what are the next posts it needs?
    for example, imagine user A wants to load more posts but user B creates a post just as user A asks for more posts. Should user A's app update the previously loaded posts so that this new post shows up? or should user A's app only fetch the next N posts? ask me questions if this scenario is not clear
    alternatively, when loading the next n posts, you can simply fetch the current m + the next n posts. for example, if the first 10 posts are loaded, fetching the next 10 means getting 20 posts back (10 old + 10 new) and merely replacing the post list with this list of 20. where might this lead to a frictional user experience?

where to look in the code:

  • consider modifying the post store to have a function that takes a number, queries the backend for that number of posts
  • consider having an index that tracks how many posts are loaded
  • use fetchPosts() as an example.

@parkermg
Copy link
Contributor

parkermg commented Feb 2, 2019

Might need to adapt some components to PureComponent (like PostData, Post) to prevent FlatList from rerendering nonchanging components.

@noushinquazi
Copy link
Contributor Author

Check which components within the post component are rerendering by console logging inside their render funcs. Either way, mobx will not allow pure components to be observers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants