Fix tech report pagination: Hide next/prev links based on actual data, reset to page 1 on filter changes#1094
Merged
max-ostapenko merged 5 commits intomainfrom Jul 31, 2025
Merged
Conversation
…, reset to page 1 on filter changes Co-authored-by: max-ostapenko <1611259+max-ostapenko@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Tech Report:
Fix tech report pagination: Hide next/prev links based on actual data, reset to page 1 on filter changes
Jul 31, 2025
Next page available on categories report even when there is no more technologies
Contributor
|
@copilot fix errors detected in the linting checks |
Co-authored-by: max-ostapenko <1611259+max-ostapenko@users.noreply.github.com>
Contributor
Author
Fixed the linting errors in commit 8188f5a. The issues were whitespace on blank lines in the Python test file (flake8 W293 violations). All linting checks now pass:
Tests continue to pass after the fix. |
Contributor
|
@tunetheweb wanted to get rid of the errors, so asked a friend for help. |
tunetheweb
approved these changes
Jul 31, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 fixes the tech report pagination issue where the "Next page" link was displayed even when there were no more technologies to show, leading to 400 errors when users clicked on it.
Problem
The pagination logic had two main issues:
last_pageparameter, which defaulted toFalse, meaning the link was always shown regardless of actual data availabilitySolution
The fix involves three key changes:
1. Dynamic Pagination Control in Frontend
Modified
src/js/techreport/utils/data.jsto calculate the actual total pages based on API data and dynamically show/hide pagination links:2. Template Updates for JavaScript Control
Updated
templates/techreport/category.htmlto initially hide pagination links withstyle="display: none;"and let JavaScript control their visibility based on actual data rather than server-side logic.3. Filter Reset to Page 1
Modified
src/js/components/filters.jsto automatically reset to page 1 when any filter changes:Testing
Before/After Behavior
This ensures users have a better experience when browsing tech reports and eliminates the confusing 400 errors from invalid pagination requests.
Fixes #1088.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.