-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Better Infinite Scroll #75
Better Infinite Scroll #75
Conversation
…move fetch data function to out of UseEffect- Add a loading more element
Add observer to handle load more content
Move logic from handleLoadingMore to useEffect
Improve shrink header function to return removing listener function used in unmount section
Display posts contain image only
Update loading more spinner
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/gregrickaby/reddit-image-viewer/35w1orjq5 |
f7d02a1
to
efd8db7
Compare
efd8db7
to
c376dcb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@icegotcha Wow! This is perfect, thank you! Feel free to take on other issues
Description
According to #60, I updated the viewer to fully support infinite scroll as follow:
siteHead.js
to fetch only 5 posts.Besides, I also made minor changes:
results
store an array instead. I found it's easier to handle displaying posts.setSearchTerm
to solve performance issues.shrinkHeader
to check ifel
is null before adding a listener and return a removing listener function used in the first useEffect().Screenshot
https://imgur.com/a/8rTfmKs