HomePhabricator

[explorer] Fix pagination for larger page counts

Description

[explorer] Fix pagination for larger page counts

Summary:
The current pagination algorithm uses a ranking method for slot width that depends on the number of digits, but is limited to 9 digits (in fact 5 as 10000 is supported which is a bug).

This diff makes it generic so it works with any page number, which in turn fixes the pagination for the testnet explorer blocks page (>15000 pages).

It involves a log10 computation instead of the branching selection. Because of javascript I have no idea if this performs better or worse than the previous version but it's a single computation per page so the impact is negligible anyway.

Test Plan: Run the explorer and check the pagination is correct. A testnet explorer can be used to see page numbers above 10000.

Reviewers: #bitcoin_abc, bytesofman

Reviewed By: #bitcoin_abc, bytesofman

Subscribers: bytesofman

Differential Revision: https://reviews.bitcoinabc.org/D14456

Details

Provenance
FabienAuthored on Sep 6 2023, 13:43
FabienPushed on Sep 7 2023, 12:26
Reviewer
Restricted Project
Differential Revision
D14456: [explorer] Fix pagination for larger page counts
Parents
rABCd9dab1dfc769: [explorer] Properly handle the search bar
Branches
Unknown
Tags
Unknown