ubershmekel / redditp

Convert any reddit page to a presentation or slide show
https://redditp.com
MIT License
259 stars 101 forks source link

Site goes back to first image randomly #130

Open sander1095 opened 3 years ago

sander1095 commented 3 years ago

Hello!

I have a difficult time reproducing this, so I apologize for a vague issue..

I use Firefox on my OnePlus 6T. Whenever I use your (amazing) site, sometimes when I swipe to the next image it just goes back to the first image.

Sometimes it takes 20 images, sometimes only 3.

What other info can I give you to help you figure this out?

ubershmekel commented 3 years ago

Is it reaching the end and rotating back to the start? How often does it happen?

sander1095 commented 3 years ago

Hello!

Good news, I just managed to reproduce it.

Let's say x = 35.

If there are x items loaded and I am on item X and scroll to the right before the next items are loaded, it goes back to item 1. It should wait and load x + 1 instead.

ubershmekel commented 3 years ago

The wrap-around functionality is for situations where the subreddit has no more images. I could perhaps start to load the next set of posts when you hit the slide before the last, not on the last slide. Just so there would be less chance of you missing. I guess you're swiping quickly compared to how fast the loading is.

sander1095 commented 3 years ago

I would suggest that wrap around only activates when there are no more images on the subreddit, and perhaps notifying the user they have been brought back to the beginning again.

Currently I am brought back to the start because the next images are not loaded yet; not because there are no more images to he loaded. This last scenario sounds like your intention but doesn't really work well.

So when someone scrolls to the next image which is not loaded yet, we have to wait unt that api call is done. If the api call returns no images, the subreddit has no more images to show so we can wrap around. If the api does return images, we load the next one.

I dont know how often images are loaded currently, but perhaps loading them 10-15 images before the current last one is accessed would prevent the user from having to wait?