fix: select menu for paginators over 25 pages #1604
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Type
Description
This fix enables
interactions.ext.paginators
Paginator
with over 25 pages to be used with a select menu, using a "scrolling window" of pages in the paginator select menu.In this implementation, for a paginator with
N
pages whereN > 25
, the first entry in the menu starts moving forward starting Page13
, showing page options2
to26
. The first entry stops moving forward on pageN - 12
; if a paginator has 40 pages, the select menu will show page options16
to40
starting Page28
.Changes
Paginator.create_components()
section creating the select menu componentRelated Issues
#1603
Test Scenarios
Replace the number in
range(40)
with any number at least 26. The paginator should be sent without errors. Select menu should show only 25 entries, and the option for Page 1 should disappear starting Page 14.On the other hand, if the number in
range(40)
is 25 or less, all page options should show, without disappearing options.Python Compatibility
3.10.x
3.11.x
Checklist
pre-commit
code linter over all edited files