docs: fix type definition errors in useQuery options#9596
docs: fix type definition errors in useQuery options#9596manudeli merged 2 commits intoTanStack:mainfrom
Conversation
WalkthroughDocumentation for React useQuery options was updated to correct and clarify type signatures for staleTime, placeholderData, structuralSharing, and queryClient. No source or runtime changes are indicated. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
docs/framework/react/reference/useQuery.md (1)
162-167: AlignstructuralSharingdocs with the genericTDatasignatureVerified that the core implementation in
packages/query-core/src/utils.tsuses the genericTDatafor both input and return values of the structural sharing function (see lines 364–366), so the documentation should reflect that for consistency and precision.Attention in:
docs/framework/react/reference/useQuery.md(around lines 162–167)Apply this optional refactor:
- `structuralSharing: boolean | (oldData: unknown | undefined, newData: unknown) => unknown` + `structuralSharing: boolean | (oldData: TData | undefined, newData: TData) => TData`
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
docs/framework/react/reference/useQuery.md(3 hunks)
🔇 Additional comments (3)
docs/framework/react/reference/useQuery.md (3)
94-101: Correct union fix for staleTime.Adding the missing union separator before the function type is correct and matches the narrative below that allows a function and the
'static'literal.
157-162: placeholderData function signature separator is now correct.Replacing the parameter semicolon with a comma and removing the trailing comma resolves the TS syntax issue and aligns with the described semantics.
181-182: Trailing comma removal for queryClient param is correct.This yields a valid, idiomatic optional parameter listing in the docs.
|
That's a great opinion! |
|
View your CI Pipeline Execution ↗ for commit fef85e9
☁️ Nx Cloud last updated this comment at |
Summary
This PR fixes several type definition issues in the
useQuerydocumentation for better accuracy and consistency.Changes
Fix union type error
|before the function type.Fix parameter separator error
;→,) and removed redundant trailing comma in function parameters.Remove unnecessary parenthesis
Why
useQueryimplementation.Summary by CodeRabbit