Skip to content

docs(loops): document the server-rendered loop page query parameter - #396

Open
asachs01 wants to merge 1 commit into
CoreBunch:mainfrom
wyre-technology:docs/loop-page-query-param
Open

docs(loops): document the server-rendered loop page query parameter#396
asachs01 wants to merge 1 commit into
CoreBunch:mainfrom
wyre-technology:docs/loop-page-query-param

Conversation

@asachs01

Copy link
Copy Markdown

Summary

An infinite-mode loop already server-renders any page of its own results from ?loop_<loopNodeId>_page=N. loopPageQueryKey builds the name (server/publish/loopPrefetch.ts:177), readPageNumber reads it (:204), and publicRouter.ts:224-240 deliberately routes any request carrying it past the Layer A disk artefact into a live Layer B render.

The parameter is not undocumented — but it is documented only as a cache-invalidation input, in docs/architecture.md:240, docs/server.md:487, docs/features/publisher.md:19,384,474 and docs/reference/architecture-tests.md:202. All six describe how it affects the fast path, none mention that it renders a different page.

docs/features/loops.md — the doc a page author actually reads, and the one that describes the pagination modes — never mentions it. Its "Pagination" section instead recommends a manual workaround for precisely the case the parameter already covers:

For static multi-page navigation (no JS required):

  • Use separate base.loop nodes with an offset filter — one per "page" — and static links between pages.

This adds a ### Deep-link to a loop page subsection next to that one, and points the existing bullet at it.

What it documents

The mechanism, plus the four constraints that bound it — deliberately, so the section cannot be read as promising a numbered paginator:

Constraint Source
honoured only when pagination: 'infinite', silently ignored otherwise loopPrefetch.ts:229
never applies to contextual sources (entry.field) loopPrefetch.ts:292-299, renderLoop.ts:155-159
a page past the end renders the empty string — no wrapper, no attributes renderLoop.ts:78-80
no item or page total is exposed anywhere, so "Page 3 of 12" is not derivable renderLoop.ts:111-116, server/handlers/cms/loop.ts:131,169

src/modules/base/loop/index.ts:17-23 says numeric pagination will live in a future base.pagination module, so per docs/CONVENTIONS.md rule 8 nothing here describes that as existing.

Also in the same change, since they belong to the same section:

  • a "Forbidden patterns" row for the silent-ignore case (rule 6);
  • canonicalRenderQuery.test.ts and static-artefact-served-before-render.test.ts added to the "Gate tests" list, and publicRouter.ts to the source-of-truth list (rule 4).

Verification

Docs-only — no code changed, so no new test. Claims were checked against the source at 6b055cf7 and against the existing suites:

$ bun test src/__tests__/publisher/canonicalRenderQuery.test.ts \
           src/__tests__/publisher/loopRender.test.ts \
           src/__tests__/architecture/static-artefact-served-before-render.test.ts
 20 pass
 0 fail
Ran 20 tests across 3 files. [187.00ms]

and the canonicalisation claim directly:

"?utm_source=x&gclid=y"          -> ""
"?loop_ABC_page=2"               -> "?loop_ABC_page=2"
"?utm_source=x&loop_ABC_page=2"  -> "?loop_ABC_page=2"
"?loop_B_page=3&loop_A_page=2"   -> "?loop_A_page=2&loop_B_page=3"

File is 531 lines, within the ~600 cap. No nav registration needed — docs/README.md indexes files, not subsections.

Note

#350 also touches docs/features/loops.md, but adds a subsection around line 265; this one lands in the Cookbook at 460+. They should not conflict.

Happy to cut the "Forbidden patterns" row or the gate-test lines if you would rather keep this to the new subsection alone.

An infinite-mode loop already renders any page of its own results from
`?loop_<loopNodeId>_page=N` — loopPrefetch.ts builds and reads the param,
and publicRouter.ts routes requests carrying it past the Layer A artefact
into a live render.

The parameter is documented today only as a cache-invalidation input, in
architecture.md, server.md, publisher.md and reference/architecture-tests.md.
features/loops.md — the doc a page author reads, and the one that describes
the pagination modes — never mentions it, and its Pagination section instead
recommends a manual one-loop-node-per-page workaround for exactly the case
the parameter already covers.

Documents the parameter with its four real constraints (infinite-only,
no contextual sources, empty render past the end, no exposed total) so the
section does not promise a numbered paginator the runtime cannot support.
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.

1 participant