Skip to content

Document multiple aggregates in one component via namespace prefixes - #285

Draft
reeceyang wants to merge 1 commit into
mainfrom
reece/namespace-prefix-docs
Draft

reeceyang wants to merge 1 commit into
mainfrom
reece/namespace-prefix-docs

Conversation

@reeceyang

@reeceyang reeceyang commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

An alternative to #278 that needs no component changes. Each aggregate starts every namespace with a name for that aggregate, e.g. ["byGame", doc.gameId] or "scores", so several aggregates can share one component.

README changes, following the structure of #278:

  • All client construction examples use components.aggregate with a namespace prefix.
  • "Defining multiple aggregates" moves after "Aggregate without a table" and explains the convention and its caveats:
    • Prefixes must not collide.
    • clearAll, makeAllRootsLazy, iterNamespaces and paginateNamespaces span every aggregate in the component.
    • Only one aggregate per component should omit namespace.
  • The Repair section suggests clearing per namespace or changing the prefix.
  • The Queued writes note says the all-or-none async/stale rule applies across the component, and shows a second component instance for queued aggregates.

The cost is that every call needs the full namespace, including aggregates that weren't namespaced before. A follow-up draft PR explores a client-side namespacePrefix that hides this.

🤖 Generated with Claude Code

@pkg-pr-new

pkg-pr-new Bot commented Nov 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@convex-dev/aggregate@285

commit: e050806

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