implement automatic journal pagination #2058
Open
+124
−19
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.
This PR implements automatic pagination for the journal report as a solution to improve performance opening journal page.
At high level, it involves
journal.html
handlespage
parameter in request.paginated
attribute on the<fava-journal>
custom element.FavaJournal
checks if there ispaginated
attribute set, it automatically starts fetching all the remaining pages and append them to the<ol>
.With pagination, it's desirable for entries that show up first to be loaded first. Journal table currently renders in date ascendant but the default and most commonly useful order is date descendant, so this PR also changes the rendering order from
asc
todesc
and negate the sort value.1000 is used as the fixed per-page number because based on my local testing, it is a reasonable balance between initial delay vs. number of pages. It could potentially go up to 2,000.