Skip to content

feat(Assemble): Pagination.linkTotal and lastUnknown - #587

Merged
thomasfosterau merged 1 commit into
trunkfrom
issue-569-link-total
Nov 12, 2026
Merged

thomasfosterau merged 1 commit into
trunkfrom
issue-569-link-total

Conversation

@thomasfosterau

Copy link
Copy Markdown
Owner

Summary

Part 2 of #569 (part 1, edgePage forwarding query, merged in #571). Semantics confirmed by gardeneria (gardeneria#1263 O8).

  • Assemble.Pagination.linkTotal?: number: the total the offset pagination links (last, and whether next exists) are computed from. Defaults to totalCount. meta.totalCount stays totalCount.
  • Assemble.Pagination.lastUnknown?: boolean (default false): when true, links.last is omitted (key absent, not null); self / first / prev / next stay exact, computed from linkTotal. Also applies on an unpageable window (limit <= 0).
  • Assemble.edgePage's input gains and forwards both.
  • Search case: linkTotal = offset + page.length + (hasMore ? 1 : 0) with lastUnknown: true, so next exists exactly when there is more. Documented with an executed docgen example on collection.

collection and edgePage are the only consumers of Pagination (Handlers/Group call offsetPaginationLinks directly, unchanged).

Closes #569

Verification

Run in the worktree, in AGENTS.md order:

  • pnpm install --frozen-lockfile: pass
  • vp run build: pass
  • vp check: pass (0 errors, 5301 warnings, none in src/Assemble*; a clean-trunk baseline total could not be captured, the lint run on a stashed tree failed before analysis)
  • vp run check: pass
  • vp run -r test:unit: pass (root 3997 tests, 64 files)
  • vp run docgen: pass (re-run with --no-cache)
  • vp run test:coverage then vp exec fallow audit --base origin/trunk: pass, no issues in 3 changed files

Changeset

  • .changeset/pagination-link-total.md: minor

Notes

No published type changes: Handlers.LinksValue.last was already optional, so CollectionDocument.links already allows last to be absent. The new Pagination members are additive and spelled readonly x?: T per the owner rule. @since 0.22.0. Does not touch the capabilities code (#567).


Generated by Claude Code

@changeset-bot

changeset-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 68c2b3f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@thomasfosterau/effect-jsonapi Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

Assemble.edgePage drops the request query from its links; Pagination lacks linkTotal / lastUnknown (gardeneria#1263 O8)

2 participants