There seems to be a timing issue with it though. If a "next page" starts loading, but you navigate away before it's finished, then this "next page" might be end up being appended to the new page you're on.
So you might be browsing User A's profile, click over to User B, and then see User A's second page appended to User B's profile.
One solution would be to abort the loading when a page is navigated away from. I think this can be done by deleting the IntersectionObserver on disconnect although I haven't tried that yet.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for sharing this! I used it on buildinpublic.com
There seems to be a timing issue with it though. If a "next page" starts loading, but you navigate away before it's finished, then this "next page" might be end up being appended to the new page you're on.
So you might be browsing User A's profile, click over to User B, and then see User A's second page appended to User B's profile.
One solution would be to abort the loading when a page is navigated away from. I think this can be done by deleting the
IntersectionObserver
ondisconnect
although I haven't tried that yet.