Skip to content

docs(query): use the v5 filters-object form in QueryCache examples#10873

Open
DucMinhNe wants to merge 1 commit into
TanStack:mainfrom
DucMinhNe:fix/docs-querycache-v5-filters
Open

docs(query): use the v5 filters-object form in QueryCache examples#10873
DucMinhNe wants to merge 1 commit into
TanStack:mainfrom
DucMinhNe:fix/docs-querycache-v5-filters

Conversation

@DucMinhNe
Copy link
Copy Markdown

@DucMinhNe DucMinhNe commented Jun 4, 2026

Description

The QueryCache reference examples call find / findAll with a positional query key — the v4 signature. In v5, both take a single filters object, which is what this page's own Options already document (filters?: QueryFilters). The examples are therefore out of date and won't type-check / behave as shown on v5.

Updated the three examples to the v5 form:

queryCache.find({ queryKey: ['posts'] })
queryCache.find({ queryKey })
queryCache.findAll({ queryKey })

Docs-only; brings the examples in line with the v5 API and the Options already listed on the page.

Summary by CodeRabbit

  • Documentation
    • Updated QueryCache documentation examples with corrected method signatures for find and findAll operations.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Documentation examples for queryCache.find() and queryCache.findAll() are updated to reflect the API's options object signature. Three code snippets now show calling these methods with { queryKey } instead of passing queryKey directly.

Changes

QueryCache API documentation updates

Layer / File(s) Summary
API signature examples for find and findAll
docs/reference/QueryCache.md
Three code examples show the updated method signatures: top-level usage, queryCache.find documentation, and queryCache.findAll documentation now pass { queryKey } as an options object instead of passing queryKey directly.

🎯 1 (Trivial) | ⏱️ ~2 minutes

🐰 Three examples hop along the docs, so fine and findAll,
Wrapped in options now, { queryKey } for all,
A little refactor, quite clean and small! 📚

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides good context about the v4 vs v5 API change and lists the updated examples, but does not follow the repository's required template structure with 🎯 Changes, ✅ Checklist, and 🚀 Release Impact sections. Restructure the description to match the template by adding the required sections: move the explanation under '## 🎯 Changes', add the '## ✅ Checklist' section with the two checkboxes, and confirm under '## 🚀 Release Impact' that this is docs-only.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating QueryCache documentation examples to use v5 filters-object form instead of the v4 positional query key approach.
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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
docs/reference/QueryCache.md (2)

60-60: ⚡ Quick win

Documentation inconsistency: filters parameter is required, not optional.

The documented signature shows filters?: QueryFilters, but the actual implementation requires the filters parameter with a mandatory queryKey property: find(filters: WithRequired<QueryFilters, 'queryKey'>).

This is a pre-existing issue not introduced by this PR, but should be corrected for accuracy.

📝 Suggested documentation fix
-- `filters?: QueryFilters`: [Query Filters](../framework/react/guides/filters#query-filters)
+- `filters: QueryFilters`: [Query Filters](../framework/react/guides/filters#query-filters)
+  - `queryKey` is required within the filters object
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/reference/QueryCache.md` at line 60, Update the documentation to match
the implementation: change the `filters?: QueryFilters` entry to indicate
`filters` is required and must include a `queryKey` (e.g., reflect the
implementation signature `find(filters: WithRequired<QueryFilters,
'queryKey'>)`). Ensure the docs for QueryCache (the `filters` parameter) mention
that `queryKey` is mandatory and describe its expected shape or link to the
QueryFilters type. Keep wording minimal and precise so callers know `filters` is
not optional and must contain `queryKey`.

79-80: ⚡ Quick win

Documentation format could be clearer about the single filters parameter.

The current format lists queryKey and filters as if they are separate parameters, but findAll actually accepts a single filters parameter where queryKey is an optional property of that object.

This is a pre-existing issue not introduced by this PR, but could be clarified to avoid confusion.

📝 Suggested documentation fix
 **Options**
 
-- `queryKey?: QueryKey`: [Query Keys](../framework/react/guides/query-keys.md)
-- `filters?: QueryFilters`: [Query Filters](../framework/react/guides/filters.md#query-filters)
+- `filters?: QueryFilters`: [Query Filters](../framework/react/guides/filters.md#query-filters)
+  - `queryKey?: QueryKey`: [Query Keys](../framework/react/guides/query-keys.md) - Optional query key to filter by
+  - Plus other filter options as documented in Query Filters
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/reference/QueryCache.md` around lines 79 - 80, Update the docs to
clarify that the findAll API accepts a single "filters" object parameter (type
QueryFilters) which may include an optional queryKey property, rather than two
separate parameters; change the parameter list to show a single entry like
"filters?: QueryFilters (where filters.queryKey?: QueryKey)" and update the
links to point to the QueryFilters and Query Keys docs so readers understand
queryKey is a property on the filters object (refer to the findAll function and
the QueryFilters and QueryKey types to ensure accurate wording).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@docs/reference/QueryCache.md`:
- Line 60: Update the documentation to match the implementation: change the
`filters?: QueryFilters` entry to indicate `filters` is required and must
include a `queryKey` (e.g., reflect the implementation signature `find(filters:
WithRequired<QueryFilters, 'queryKey'>)`). Ensure the docs for QueryCache (the
`filters` parameter) mention that `queryKey` is mandatory and describe its
expected shape or link to the QueryFilters type. Keep wording minimal and
precise so callers know `filters` is not optional and must contain `queryKey`.
- Around line 79-80: Update the docs to clarify that the findAll API accepts a
single "filters" object parameter (type QueryFilters) which may include an
optional queryKey property, rather than two separate parameters; change the
parameter list to show a single entry like "filters?: QueryFilters (where
filters.queryKey?: QueryKey)" and update the links to point to the QueryFilters
and Query Keys docs so readers understand queryKey is a property on the filters
object (refer to the findAll function and the QueryFilters and QueryKey types to
ensure accurate wording).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d5c91d78-d917-4ac4-b1b7-ff3c04b0eb1d

📥 Commits

Reviewing files that changed from the base of the PR and between 8f6f923 and 98b4c28.

📒 Files selected for processing (1)
  • docs/reference/QueryCache.md

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jun 4, 2026

View your CI Pipeline Execution ↗ for commit 98b4c28

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

☁️ Nx Cloud last updated this comment at 2026-06-04 02:11:26 UTC

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 4, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 98b4c28

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