Suwayomi / Suwayomi-WebUI

Mozilla Public License 2.0
105 stars 48 forks source link

[Bug] WebUI preloading entire page list #719

Closed Secozzi closed 4 months ago

Secozzi commented 4 months ago

Device information

Steps to reproduce

  1. Click on a chapter

Expected behavior

Only a set number of images should be preloaded

Actual behavior

The entire list gets preloaded, and the client will load the images again when scrolled into view. (The server doesn't load the images twice)

schroda commented 4 months ago

what do you mean by the client will load the images again when scrolled into view? are they actually getting requested again from the server or are they loaded from the cache?

Secozzi commented 4 months ago

According to devtools, they're requested twice. Once when the entire list gets preloaded, then again when the page is scrolled into view

schroda commented 4 months ago

are they requested twice because they show up twice in the devtools or are they requested twice because the second request was actually fulfilled by the server instead of being served from the cache?

because it works as expected for me - if the first request was successful the second request will just get served from the cache, as can be seen in the "Fulfilled by" column of the request

Secozzi commented 4 months ago

The second request appears to be request twice, the transferred column doesn't mention anything about cache, and when scrolling into view there's a loading circle before the page is loaded.

schroda commented 4 months ago

I can't reproduce this, please provide a screenshot from the network tab where this is the case

Secozzi commented 4 months ago

https://github.com/Suwayomi/Suwayomi-WebUI/assets/49240133/f1a3e6cf-f683-41ff-b462-b6d7bc1012d9

schroda commented 4 months ago

this is caused by the service worker that is registered, which the webUI does not provide itself, I assume you served VUI at some point via the server

you have to remove the server worker for it to work properly, go to the application tab > serverice worker and unregister it

Secozzi commented 4 months ago

Ah, after unregistering that the images are being cached correctly.

On another note, it still tries to preload the entire list of pages as shown in the video, and if i understood https://github.com/Suwayomi/Suwayomi-WebUI/issues/662#issuecomment-2010155444 correctly it should only preload a set number of images, should it not?

schroda commented 4 months ago

there is currently no lazy loading for preloading pages

it will just request all pages, but only 5 images will be requested in parallel, so in case the reader gets left or the chapter gets changed, all queued/running image requests get canceled

so for preloading only n pages ahead, a feature request should be opened

schroda commented 4 months ago

with #722 the service worker gets unregistered now, so this should not happen anymore and the server should not get spammed with image requests

I'll close this bug issue with #722 being integrated, as mentioned for the "preloading only n pages ahead" functionality, please create a feature request

Secozzi commented 4 months ago

I see, thanks for the clarification