-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(tanstack-react-query): skip inferring initialData
#6793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe changes update a generic type usage in the Changes
Sequence Diagram(s)sequenceDiagram
participant TestRunner
participant ReactComponent
participant QueryClient
participant PostRouter
TestRunner->>ReactComponent: Render with useQuery (post.list, initialData: [])
ReactComponent->>QueryClient: Fetch post.list query
QueryClient->>PostRouter: Call list procedure
PostRouter-->>QueryClient: Return posts array
QueryClient-->>ReactComponent: Provide data (Post[])
ReactComponent-->>TestRunner: Render output with post title
Suggested labels
Poem
π Recent review detailsConfiguration used: CodeRabbit UI π Files selected for processing (2)
𧰠Additional context used𧬠Code Graph Analysis (1)packages/tanstack-react-query/src/internals/queryOptions.ts (1)
β° Context from checks skipped due to timeout of 90000ms (18)
π Additional comments (5)
β¨ Finishing Touches
πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
|
π Deployed to the trpc-pr-6793 environment in trpc-sse-and-websockets
|
@trpc/client
@trpc/next
@trpc/react-query
@trpc/server
@trpc/tanstack-react-query
@trpc/upgrade
commit: |
initialDatainitialData
| function MyComponent() { | ||
| const trpc = useTRPC(); | ||
| const queryOptions = trpc.post.list.queryOptions(undefined, { | ||
| initialData: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe verify that it works with both initialData and a select which changes the type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i did but i'll add a persistent test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think i did at least
β¦+ `select` (#6794) #6793 (comment) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Tests** - Added a new test to verify correct data type inference when using initial data with a select function. - Improved an existing test to directly assert the data type without early exit conditions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you. |
Closes #6792
Closes #6791
π― Changes
What changes are made in this PR? Is it a feature or a bug fix?
β Checklist
Summary by CodeRabbit