Skip to content

fix: correct GenericList pagination offset for postShift > 0#114

Closed
persd wants to merge 1 commit into
astrofrom
fix/generic-list-pagination-offset
Closed

fix: correct GenericList pagination offset for postShift > 0#114
persd wants to merge 1 commit into
astrofrom
fix/generic-list-pagination-offset

Conversation

@persd

@persd persd commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Problem

When postShift > 0 (e.g. aerotelegraph uses postShift=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 2d30cdb introduced isAjaxCall/isFirstCall branching in WidgetHelper_calculateOffsetForGenericListPagination that incorrectly omitted postShift from the offset calculation for AJAX calls. This was not caught because all other HAT projects use postShift=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.14.14.2

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.
@persd persd force-pushed the fix/generic-list-pagination-offset branch from d121345 to 6eb3a94 Compare June 3, 2026 14:03
@persd persd requested a review from Copilot June 8, 2026 07:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_calculateOffsetForGenericListPagination to a single offset formula (totalItemsBefore + postShiftValue) and removed isAjaxCall / isFirstCall branching.
  • Updated all call sites to use the new helper signature and removed the client-side isFirstCall query 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.14.14.2.

@persd persd closed this Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants