Skip to content

feat(blocks): entries() reads only the index; list() throws - #781

Merged
tlgimenes merged 7 commits into
mainfrom
cdn-cms/entries
Nov 9, 2026
Merged

tlgimenes merged 7 commits into
mainfrom
cdn-cms/entries

Conversation

@tlgimenes

@tlgimenes tlgimenes commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • client.entries(type?) answers { name, type, path?, refs, noIndex? } for every saved block (or one type) from the release index alone: no block body is fetched, and the same frozen array comes back per index and type.
  • client.list() was removed in 8.12. It fetched the body of every block of a type, one CDN request per block on a hosted release (730 requests for one site's sitemap). The member stays on Client, marked @deprecated with the same guidance, so old code still compiles. At runtime it throws at once, before any index read, draft read or fetch, on release and draft clients alike.
  • The old warn-once path (warnRoutedList, LIST_WARNED, resetListWarnings) is gone.

The error

[decocms/blocks] client.list() was removed in this version of @decocms/blocks: it fetched the body of every block of a type. Route with client.routes() and client.redirects() (index only); read a type's names, paths, refs and noIndex with client.entries(type) (index only); read a block's body with client.resolve(name).

Exported as LIST_REMOVED from the client module.

Migration

Before After
list("page") to route routes() → matchRoute → resolve(name) (index only)
list("redirects") redirects() (index only)
list("page") for a sitemap entries("page"): paths without :param/* and without noIndex
list<Post>("post", { sort, limit }) entries("post"), then one resolve(name) per post shown
a map keyed by path one saved block per path, found through entries()

What was migrated

  • packages/blocks: CMSClient.list throws LIST_REMOVED; types.ts keeps the deprecated signature; new list.test.ts (throws for every type, with and without options, on local content, a hosted release and a draft client; fetches nothing, loads nothing and pins no index; an awaited call rejects; the message names the replacements; nothing is warned); conformance tests assert the throw.
  • Examples (nextjs-smoke, nextjs-binding-smoke) and guides read entries().
  • README and CLAUDE.md describe entries() and the removal.
  • Skills: deco-make-editable, deco-nextjs-site, deco-site-authoring use entries() + resolve(name); deco-v7-to-v8-migration's checkContentReads.ts reports each client.list() call as "client.list() throws" and names routes(), redirects(), entries(type) and resolve(name); its references say list() was removed in 8.12, throws and still typechecks. .agents/skills/README.md regenerated.

🤖 Generated with Claude Code

tlgimenes and others added 7 commits November 9, 2026 17:57
client.list(type) fetched the body of every block of a type: on a hosted
release one CDN request per block (730 on umbro's sitemap). Sites only
ever needed what the release index already holds, so the client now
answers that from the index alone and never enumerates bodies.

- client.entries(type?): { name, type, path?, refs, noIndex? } for every
  typed entry (of type, through its aliases, when given), in code-unit
  order of name, with zero block fetches; the same frozen array per index
  and type. Answers from the pin once the client pinned, like routes().
- client.list() and ListOptions are gone from the Client type, the root
  exports and the client; the list-routing warning and namesOfType go
  with them. Entry is exported instead.
- blockMeta computes noIndex (META_VERSION 2): true for a page (a body with
  a top-level path) whose seo says noIndexing, inline or through the saved
  SEO block it references, resolved by an optional bodyOf. pageNoIndex,
  seoNoIndex, BodyOf and META_VERSION are exported from
  @decocms/blocks/protocol for Studio's publish; the shared vectors gain
  three noIndex cases.
- remoteLoader reads the index's metaVersion (absent or unreadable: 1) and
  keeps meta.noIndex; entries() reports noIndex as a boolean only on an
  index at meta version 2 or later, and leaves it out on an older one.
- Local content (a snapshot, .deco/blocks, tests, dev) is indexed at
  META_VERSION with saved SEO blocks resolved from its own bodies; a
  draft's overlay recomputes noIndex for the blocks it sets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Next.js examples route posts from entries("post") and read the one
post that matched; the blog index lists names and paths from the index.
README and CLAUDE.md describe entries(), noIndex and metaVersion.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The migration never writes client.list(); its imports step now reports
every list() call on a CMS client and every build-time scan of
.deco/blocks as work left, with the fix (entries() from the index, or one
resolve(name)). scripts/checkContentReads.ts exits 1 while a site still
calls list(), and the verify step runs it. The references explain
sitemaps from entries("page") and one saved block per path for big
path-keyed maps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The two script headers called the removal "the next major"; it ships in
the 8.12 minor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ries() and resolve()

Code written against an older @decocms/blocks still calls client.list();
with the member gone it failed only on the typecheck, and a site built
without one (or calling it through a wrapper typed loosely) got an opaque
"list is not a function". The member is back on Client, @deprecated, with
its old signature (ListOptions stays internal to the types), so old code
compiles and fails loudly at runtime instead:

- CMSClient.list throws LIST_REMOVED at once, before reading the index or
  fetching anything: it says list() was removed in this version and names
  the replacements, routes() and redirects() for routing (index only),
  entries(type) for a type's names, paths, refs and noIndex (index only),
  and resolve(name) for one body.
- list.test.ts: it throws for every type, with or without options, on
  local content and on a hosted release, fetches nothing and pins no index;
  an awaited call rejects with the same error; nothing is warned.
- The conformance tests assert the deprecated member and its signature
  instead of its absence; README and CLAUDE.md say 8.12 removed it and
  that it throws.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…() throws

- deco-make-editable: a collection is read with client.entries(type) and
  one client.resolve(name) per document shown, not client.list(type).
- deco-nextjs-site and deco-site-authoring: blog posts are routed from the
  { name, path } of entries("post"); list() was removed and throws.
- deco-v7-to-v8-migration: checkContentReads reports "client.list()
  throws" and names routes(), redirects(), entries(type) and
  resolve(name); verify, nextjs and hosted-releases say it was removed in
  8.12 and still typechecks, so only the check finds a call.
- The skills index is regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@tlgimenes tlgimenes changed the title feat(blocks): entries() reads only the index; remove list() feat(blocks): entries() reads only the index; list() throws Nov 9, 2026
@tlgimenes
tlgimenes merged commit 07ba5c5 into main Nov 9, 2026
5 checks passed
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 8.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant