Able to go negative page numbering #238

Closed
opened 2026-02-06 19:28:58 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @agilob on GitHub (Jan 8, 2019).

This is probably inherited from Emby and linked to a race condition on request-> response level.

  1. Click on next page (takes a few seconds - network lag)
  2. Click twice on previous page, wait a few seconds
  3. Repeat

screenshot_20190107_215438

Seems like the "previous page" button is only disabled when lower boundary is 0:

screenshot_20190107_215727

Originally created by @agilob on GitHub (Jan 8, 2019). This is probably inherited from Emby and linked to a race condition on request-> response level. 1. Click on next page (takes a few seconds - network lag) 2. Click twice on previous page, wait a few seconds 3. Repeat ![screenshot_20190107_215438](https://user-images.githubusercontent.com/2544251/50795705-ff720d80-12c6-11e9-894e-64c057f9031e.png) Seems like the "previous page" button is only disabled when lower boundary is 0: ![screenshot_20190107_215727](https://user-images.githubusercontent.com/2544251/50795805-57107900-12c7-11e9-829b-5cf8a879ceb0.png)
OVERLORD added the bug label 2026-02-06 19:28:58 +03:00
Author
Owner

@cvium commented on GitHub (Jan 8, 2019):

I would like to add that it's a general problem. I accidentally added the same library twice because of a slow response.

@cvium commented on GitHub (Jan 8, 2019): I would like to add that it's a general problem. I accidentally added the same library twice because of a slow response.
Author
Owner

@hawken93 commented on GitHub (Jan 11, 2019):

Looking at the pagination code I want to note that splitting the paginator code from the individual libraries so it can share common logic is a possible improvement

@hawken93 commented on GitHub (Jan 11, 2019): Looking at the pagination code I want to note that splitting the paginator code from the individual libraries so it can share common logic is a possible improvement
Author
Owner

@hawken93 commented on GitHub (Jan 11, 2019):

I think what you are getting at here is that the pagination buttons should not trigger more events until the next page is loaded, and for the library I didn't really look at it, but I guess it's about waiting until the server is done as well?

For this issue it's possible to just limit the page number to 0, either by not decrementing the number past 0, or bringing it up to 0 again before processing the request. The variable that holds this information seems to stay within each of the different places in the javascript that pagination is implemented. Each one is slightly different :P But maybe deactivating the event handler while the request is processing is the better fix.

@hawken93 commented on GitHub (Jan 11, 2019): I think what you are getting at here is that the pagination buttons should not trigger more events until the next page is loaded, and for the library I didn't really look at it, but I guess it's about waiting until the server is done as well? For this issue it's possible to just limit the page number to 0, either by not decrementing the number past 0, or bringing it up to 0 again before processing the request. The variable that holds this information seems to stay within each of the different places in the javascript that pagination is implemented. Each one is slightly different :P But maybe deactivating the event handler while the request is processing is the better fix.
Author
Owner

@hawken93 commented on GitHub (Jan 11, 2019):

performance optimalization possibility
The javascript calls ApiClient.GetItems() before filtering them to the current page. This means that each pagination actually downloads information about all the items in the library before filtering them on the client side. This wastes lots of resources and should be done on the server side.

query is passed to the getItems request, so I'm wrong here

@hawken93 commented on GitHub (Jan 11, 2019): ~~**performance optimalization possibility** The javascript calls ApiClient.GetItems() before filtering them to the current page. This means that each pagination actually downloads information about all the items in the library before filtering them on the client side. This wastes lots of resources and should be done on the server side.~~ query is passed to the getItems request, so I'm wrong here
Author
Owner

@JustAMan commented on GitHub (Jan 12, 2019):

Looking at the pagination code I want to note that splitting the paginator code from the individual libraries so it can share common logic is a possible improvement

This seems to be the most fruitful approach, usually the less almost copy-paste is there the easier it is to maintain stuff.

@JustAMan commented on GitHub (Jan 12, 2019): > Looking at the pagination code I want to note that splitting the paginator code from the individual libraries so it can share common logic is a possible improvement This seems to be the most fruitful approach, usually the less _almost_ copy-paste is there the easier it is to maintain stuff.
Author
Owner

@hawken93 commented on GitHub (Jan 12, 2019):

to quote myself: I don't think I'll be trying to unify the pagination code in this PR, but if someone wants do that that then please merge them before this

@hawken93 commented on GitHub (Jan 12, 2019): to quote myself: I don't think I'll be trying to unify the pagination code in this PR, but if someone wants do that that then please merge them before this
Author
Owner

@hawken93 commented on GitHub (Jan 13, 2019):

I'm ready for review on the PR above now :)

@hawken93 commented on GitHub (Jan 13, 2019): I'm ready for review on the PR above now :)
Author
Owner

@hawken93 commented on GitHub (Jan 13, 2019):

@cvium I've also fixed the library double adding thing, so now it shows the loading indicator and ignores multiple presses until the action has returned a result :)

@hawken93 commented on GitHub (Jan 13, 2019): @cvium I've also fixed the library double adding thing, so now it shows the loading indicator and ignores multiple presses until the action has returned a result :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#238