fix: correct GenericList pagination offset for postShift > 0#114
Closed
persd wants to merge 1 commit into
Closed
Conversation
Simplified offset formula to: totalItemsBefore + postShiftValue. Removed incorrect isAjaxCall/isFirstCall branching that caused duplicate articles when postShift was non-zero (e.g. aerotelegraph postShift=3). Cleaned up unused isAjaxCall/isFirstCall params from function signature, all callers, and client-side InfiniteScrollButton.
d121345 to
6eb3a94
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes GenericList infinite-scroll pagination when postShift > 0 by making offset calculation consistent across SSR and AJAX pagination paths, preventing duplicate items between pages.
Changes:
- Simplified
WidgetHelper_calculateOffsetForGenericListPaginationto a single offset formula (totalItemsBefore + postShiftValue) and removedisAjaxCall/isFirstCallbranching. - Updated all call sites to use the new helper signature and removed the client-side
isFirstCallquery param usage. - Bumped package version to
4.14.2.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/renderlessComponents/seo/SeoMetaData/SeoListGridPrevNext.ts | Updates offset helper invocation to the simplified signature for SEO prev/next link generation. |
| src/helpers/GenericListHelper.ts | Core fix: removes incorrect branching and applies consistent offset computation including postShift. |
| src/components/widgets/Lists/GenericList/GenericListGetData.ts | Updates data fetch offset calculation to the new helper signature. |
| src/components/widgets/Lists/GenericList/GenericList.astro | Updates SSR offset calculation to the new helper signature. |
| src/components/widgets/Lists/GenericList/generalParts/InfiniteScrollButton.astro | Removes isFirstCall query param behavior from the infinite-scroll client script. |
| package.json | Version bump 4.14.1 → 4.14.2. |
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.
Problem
When
postShift > 0(e.g. aerotelegraph usespostShift=3), the GenericList infinite scroll pagination showed duplicate articles. The first 3 articles from each new page were the same as the last 3 from the previous page.Root Cause
Commit
2d30cdbintroducedisAjaxCall/isFirstCallbranching inWidgetHelper_calculateOffsetForGenericListPaginationthat incorrectly omittedpostShiftfrom the offset calculation for AJAX calls. This was not caught because all other HAT projects usepostShift=0, making all branches produce identical results.Fix
Simplified the offset formula to:
totalItemsBefore + postShiftValue— removing the incorrect branching logic. The formula is now correct regardless of whether it's an SSR or AJAX call.Version
4.14.1→4.14.2