Skip to content

docs: document materialize() helper for includes subqueries#1580

Open
kevin-dp wants to merge 1 commit into
TanStack:mainfrom
kevin-dp:docs/materialize-includes-helper
Open

docs: document materialize() helper for includes subqueries#1580
kevin-dp wants to merge 1 commit into
TanStack:mainfrom
kevin-dp:docs/materialize-includes-helper

Conversation

@kevin-dp

@kevin-dp kevin-dp commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds documentation for the materialize() helper introduced in #1504. As flagged in this comment, the helper was shipped but not yet documented.

  • Guide — new ### materialize subsection under Includes in docs/guides/live-queries.md, sitting next to the existing ### toArray subsection. Covers the array vs. singleton (findOne()) split, type inference, reactivity matching toArray(), and the expression-context restriction.
  • Reference index — adds the materialize entry to docs/reference/index.md.

The generated docs/reference/functions/materialize.md page is intentionally not included here. The release workflow (.github/workflows/release.yml) runs pnpm generate-docs on publish and opens a separate docs: regenerate API documentation PR, so committing generated reference pages from a feature PR creates conflicts. This matches the pattern used in #1544, which also added a reference-index entry for caseWhen without committing its generated page.

Test plan

  • Confirm guide section renders correctly on a preview build of the docs site
  • Verify the reference index lists materialize under ## Functions

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added comprehensive guide explaining the materialize() helper and its usage patterns
    • Updated reference documentation index with the new function entry

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7583abdb-cd84-451d-9e4d-a0ce716a0375

📥 Commits

Reviewing files that changed from the base of the PR and between 4d1abde and c5af44a.

📒 Files selected for processing (2)
  • docs/guides/live-queries.md
  • docs/reference/index.md

📝 Walkthrough

Walkthrough

This PR adds documentation for the materialize() helper function. A new guide section explains how materialize() converts included child queries to either array or singleton results, documents reactive update semantics, type inference behavior, and usage constraints. The function is also indexed in the reference documentation.

Changes

materialize() helper documentation

Layer / File(s) Summary
materialize() guide and reference documentation
docs/guides/live-queries.md, docs/reference/index.md
Guide section explains materialize() behavior for includes, reactive semantics matching toArray(), type inference rules, and top-level .select() placement requirement. Reference index entry links the new function.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • TanStack/db#1569: Adds changeset metadata describing the new materialize() helper for includes subqueries.
  • TanStack/db#1504: The code change that introduced the materialize() helper feature being documented here.

Suggested reviewers

  • samwillis

Poem

🐰 With a flick of my ear, documentation takes flight,
materialize() now glows in guides, oh what a sight!
Arrays and singletons dance in the .select() light,
No nested expression traps—just reactive might! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description provides comprehensive context about the changes, rationale, and test plan. However, the Release Impact checklist is incomplete—no checkbox is marked for either option. Mark the appropriate 'Release Impact' checkbox to indicate whether this change affects published code or is docs/CI/dev-only.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding documentation for the materialize() helper for includes subqueries.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new

pkg-pr-new Bot commented Jun 10, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-db

npm i https://pkg.pr.new/@tanstack/angular-db@1580

@tanstack/browser-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/browser-db-sqlite-persistence@1580

@tanstack/capacitor-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/capacitor-db-sqlite-persistence@1580

@tanstack/cloudflare-durable-objects-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/cloudflare-durable-objects-db-sqlite-persistence@1580

@tanstack/db

npm i https://pkg.pr.new/@tanstack/db@1580

@tanstack/db-ivm

npm i https://pkg.pr.new/@tanstack/db-ivm@1580

@tanstack/db-sqlite-persistence-core

npm i https://pkg.pr.new/@tanstack/db-sqlite-persistence-core@1580

@tanstack/electric-db-collection

npm i https://pkg.pr.new/@tanstack/electric-db-collection@1580

@tanstack/electron-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/electron-db-sqlite-persistence@1580

@tanstack/expo-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/expo-db-sqlite-persistence@1580

@tanstack/node-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/node-db-sqlite-persistence@1580

@tanstack/offline-transactions

npm i https://pkg.pr.new/@tanstack/offline-transactions@1580

@tanstack/powersync-db-collection

npm i https://pkg.pr.new/@tanstack/powersync-db-collection@1580

@tanstack/query-db-collection

npm i https://pkg.pr.new/@tanstack/query-db-collection@1580

@tanstack/react-db

npm i https://pkg.pr.new/@tanstack/react-db@1580

@tanstack/react-native-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/react-native-db-sqlite-persistence@1580

@tanstack/rxdb-db-collection

npm i https://pkg.pr.new/@tanstack/rxdb-db-collection@1580

@tanstack/solid-db

npm i https://pkg.pr.new/@tanstack/solid-db@1580

@tanstack/svelte-db

npm i https://pkg.pr.new/@tanstack/svelte-db@1580

@tanstack/tauri-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/tauri-db-sqlite-persistence@1580

@tanstack/trailbase-db-collection

npm i https://pkg.pr.new/@tanstack/trailbase-db-collection@1580

@tanstack/vue-db

npm i https://pkg.pr.new/@tanstack/vue-db@1580

commit: c5af44a

- Add a "materialize" subsection to the Includes guide in live-queries.md
  with array vs singleton (findOne) examples and notes on reactivity and
  expression-context restrictions.
- Add the materialize() entry to docs/reference/index.md. The generated
  functions/materialize.md page is produced by the release workflow's
  generate-docs step, so it is not committed here.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kevin-dp kevin-dp force-pushed the docs/materialize-includes-helper branch from b99158d to c5af44a Compare June 10, 2026 07:57
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