Skip to content

docs(preact-query): inline 'useQuery''s basic-example options instead of a 'queryOptions' factory - #11331

Merged
sukvvon merged 1 commit into
mainfrom
docs/preact-query-usequery-inline-basic-examples
Aug 30, 2026
Merged

docs(preact-query): inline 'useQuery''s basic-example options instead of a 'queryOptions' factory#11331
sukvvon merged 1 commit into
mainfrom
docs/preact-query-usequery-inline-basic-examples

Conversation

@sukvvon

@sukvvon sukvvon commented Aug 30, 2026

Copy link
Copy Markdown
Member

🎯 Changes

useQuery.ts's second and third overloads each opened with a basic-query example that wrapped its options in a queryOptions factory (const postsOptions = queryOptions({...})) even though nothing about the example needs that — no imperative call site shares the cache entry, unlike the file's hover-prefetch example where the factory is required. The very next example in each overload ("The same query, checking isPending/isError instead of status") already used an inline options object for the identical scenario, so the two adjacent examples disagreed on style for no functional reason.

Inlined both basic examples' options to match. queryOptions.ts/infiniteQueryOptions.ts themselves, and useQuery.ts's/useInfiniteQuery.ts's hover-prefetch examples, are unaffected — those genuinely need the factory to share a cache entry between a hook and an imperative API call. Checked useSuspenseQuery.ts, useSuspenseInfiniteQuery.ts, useSuspenseQueries.ts, useInfiniteQuery.ts, and useMutation.ts for the same inconsistency: none call their options factory outside of a cache-sharing example (useInfiniteQuery.ts's only factory use is its own hover-prefetch example; the other four don't call their factory at all), so no other file needed this change.

Regenerated the corresponding reference docs with pnpm run generate-docs.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Documentation
    • Simplified useQuery usage examples by showing query options inline.
    • Updated source references in the Preact useQuery documentation.
    • Clarified examples for supported useQuery overloads.

@nx-cloud

nx-cloud Bot commented Aug 30, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 47fe85f

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 3m 56s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 7s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-30 04:27:41 UTC

@sukvvon sukvvon self-assigned this Aug 30, 2026
@coderabbitai

coderabbitai Bot commented Aug 30, 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 97570410-da56-4344-8dd2-6bfc3c0c54a5

📥 Commits

Reviewing files that changed from the base of the PR and between d5402b9 and 47fe85f.

📒 Files selected for processing (2)
  • docs/framework/preact/reference/functions/useQuery.md
  • packages/preact-query/src/useQuery.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The PR updates Preact useQuery examples to pass queryKey and queryFn inline. It also updates two documentation links to the current source line numbers.

Changes

Preact useQuery documentation

Layer / File(s) Summary
Update useQuery examples and references
packages/preact-query/src/useQuery.ts, docs/framework/preact/reference/functions/useQuery.md
JSDoc and reference examples now use inline query options. Two “Defined in” links use updated source line numbers.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 47fe8

This PR only standardizes the useQuery documentation examples by inlining options where no cache-sharing factory is needed; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary documentation change: replacing the basic useQuery examples' queryOptions factory with inline options. The extra apostrophe in useQuery''s is a minor typo…
Description check ✅ Passed The description includes the required Changes, Checklist, and Release Impact sections. It explains the motivation, scope, testing, documentation regeneration, and lack of release impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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.
Full details: Title check

Explanation

The title clearly describes the primary documentation change: replacing the basic useQuery examples' queryOptions factory with inline options. The extra apostrophe in useQuery''s is a minor typo but does not obscure the change.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/preact-query-usequery-inline-basic-examples

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.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@pkg-pr-new

pkg-pr-new Bot commented Aug 30, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@11331

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@11331

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@11331

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@11331

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@11331

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@11331

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@11331

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@11331

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@11331

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@11331

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@11331

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@11331

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@11331

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@11331

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@11331

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@11331

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@11331

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@11331

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@11331

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@11331

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@11331

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@11331

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@11331

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@11331

commit: 47fe85f

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 11.89 KB (0%)
react minimal 8.85 KB (0%)

@sukvvon
sukvvon merged commit 08dc65a into main Aug 30, 2026
9 checks passed
@sukvvon
sukvvon deleted the docs/preact-query-usequery-inline-basic-examples branch August 30, 2026 06:27
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.

2 participants