-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
ref: rename queryFn to streamFn in streamedQuery #9606
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
this avoids the weirdly double-nested queryFn naming
WalkthroughRenames the streamedQuery option from queryFn to streamFn across the implementation and tests. Internal logic, control flow, and streaming semantics remain the same. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
✨ 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 (
|
View your CI Pipeline Execution ↗ for commit 98b68c2
☁️ Nx Cloud last updated this comment at |
More templates
- @tanstack/query-example-angular-auto-refetching
- @tanstack/query-example-angular-basic
- @tanstack/query-example-angular-basic-persister
- @tanstack/query-example-angular-devtools-panel
- @tanstack/query-example-angular-infinite-query-with-max-pages
- @tanstack/query-example-angular-optimistic-updates
- @tanstack/query-example-angular-pagination
- @tanstack/query-example-angular-query-options-from-a-service
- @tanstack/query-example-angular-router
- @tanstack/query-example-angular-rxjs
- @tanstack/query-example-angular-simple
- @tanstack/query-example-react-algolia
- @tanstack/query-example-react-auto-refetching
- @tanstack/query-example-react-basic
- @tanstack/query-example-react-basic-graphql-request
- @tanstack/query-example-chat
- @tanstack/query-example-react-default-query-function
- @tanstack/query-example-react-devtools-panel
- @tanstack/query-example-eslint-legacy
- @tanstack/query-example-react-infinite-query-with-max-pages
- @tanstack/query-example-react-load-more-infinite-scroll
- @tanstack/query-example-react-nextjs
- @tanstack/query-example-react-nextjs-app-prefetching
- @tanstack/query-example-nextjs-suspense-streaming
- @tanstack/query-example-react-offline
- @tanstack/query-example-react-optimistic-updates-cache
- @tanstack/query-example-react-optimistic-updates-ui
- @tanstack/query-example-react-pagination
- @tanstack/query-example-react-playground
- @tanstack/query-example-react-prefetching
- @tanstack/query-example-react-react-native
- @tanstack/query-example-react-router
- @tanstack/query-example-react-rick-morty
- @tanstack/query-example-react-shadow-dom
- @tanstack/query-example-react-simple
- @tanstack/query-example-react-star-wars
- @tanstack/query-example-react-suspense
- @tanstack/query-example-solid-astro
- @tanstack/query-example-solid-basic
- @tanstack/query-example-solid-basic-graphql-request
- @tanstack/query-example-solid-default-query-function
- @tanstack/query-example-solid-simple
- @tanstack/query-example-solid-start-streaming
- @tanstack/query-example-svelte-auto-refetching
- @tanstack/query-example-svelte-basic
- @tanstack/query-example-svelte-load-more-infinite-scroll
- @tanstack/query-example-svelte-optimistic-updates
- @tanstack/query-example-svelte-playground
- @tanstack/query-example-svelte-simple
- @tanstack/query-example-svelte-ssr
- @tanstack/query-example-svelte-star-wars
- @tanstack/query-example-vue-2.6-basic
- @tanstack/query-example-vue-2.7-basic
- @tanstack/query-example-vue-basic
- @tanstack/query-example-vue-dependent-queries
- @tanstack/query-example-vue-nuxt3
- @tanstack/query-example-vue-persister
- @tanstack/query-example-vue-simple
@tanstack/angular-query-devtools-experimental
npm i https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@9606
@tanstack/angular-query-experimental
npm i https://pkg.pr.new/@tanstack/angular-query-experimental@9606
@tanstack/eslint-plugin-query
npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@9606
@tanstack/query-async-storage-persister
npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@9606
@tanstack/query-broadcast-client-experimental
npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@9606
@tanstack/query-core
npm i https://pkg.pr.new/@tanstack/query-core@9606
@tanstack/query-devtools
npm i https://pkg.pr.new/@tanstack/query-devtools@9606
@tanstack/query-persist-client-core
npm i https://pkg.pr.new/@tanstack/query-persist-client-core@9606
@tanstack/query-sync-storage-persister
npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@9606
@tanstack/react-query
npm i https://pkg.pr.new/@tanstack/react-query@9606
@tanstack/react-query-devtools
npm i https://pkg.pr.new/@tanstack/react-query-devtools@9606
@tanstack/react-query-next-experimental
npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@9606
@tanstack/react-query-persist-client
npm i https://pkg.pr.new/@tanstack/react-query-persist-client@9606
@tanstack/solid-query
npm i https://pkg.pr.new/@tanstack/solid-query@9606
@tanstack/solid-query-devtools
npm i https://pkg.pr.new/@tanstack/solid-query-devtools@9606
@tanstack/solid-query-persist-client
npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@9606
@tanstack/svelte-query
npm i https://pkg.pr.new/@tanstack/svelte-query@9606
@tanstack/svelte-query-devtools
npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@9606
@tanstack/svelte-query-persist-client
npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@9606
@tanstack/vue-query
npm i https://pkg.pr.new/@tanstack/vue-query@9606
@tanstack/vue-query-devtools
npm i https://pkg.pr.new/@tanstack/vue-query-devtools@9606
commit: 98b68c2
Sizes for commit 98b68c2:
|
@coderabbitai
coderabbitai
bot
left a comment
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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/query-core/src/streamedQuery.ts (1)
9-9
: Fix JSDoc: @param name still says queryFn.Update the param tag to match the new API.
- * @param queryFn - The function that returns an AsyncIterable to stream data from. + * @param streamFn - The function that returns an AsyncIterable to stream data from.
🧹 Nitpick comments (1)
packages/query-core/src/__tests__/streamedQuery.test.tsx (1)
519-519
: Add a small coverage boost: streamFn returning a Promise.Your types allow Promise; add a test to lock this in.
+++ a/packages/query-core/src/__tests__/streamedQuery.test.tsx @@ describe('streamedQuery', () => { + test('should accept streamFn that returns a Promise<AsyncIterable>', async () => { + const key = queryKey() + const observer = new QueryObserver(queryClient, { + queryKey: key, + queryFn: streamedQuery({ + streamFn: async () => Promise.resolve(createAsyncNumberGenerator(2)), + }), + }) + const unsubscribe = observer.subscribe(vi.fn()) + await vi.advanceTimersByTimeAsync(100) + expect(observer.getCurrentResult()).toMatchObject({ + status: 'success', + fetchStatus: 'idle', + data: [0, 1], + }) + unsubscribe() + }) })
📜 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 (2)
packages/query-core/src/__tests__/streamedQuery.test.tsx
(9 hunks)packages/query-core/src/streamedQuery.ts
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Preview
- GitHub Check: Test
🔇 Additional comments (2)
packages/query-core/src/streamedQuery.ts (1)
23-23
: API rename verified — no remainingqueryFn
usage; callers must switch tostreamFn
. Breaking change—update release notes/changelog accordingly.packages/query-core/src/__tests__/streamedQuery.test.tsx (1)
37-37
: Tests updated to use streamFn: consistent and correct.All call sites now pass streamFn to streamedQuery while keeping QueryObserver’s queryFn as-is. Semantics preserved.
Also applies to: 81-81, 136-136, 190-192, 246-248, 303-305, 358-364, 399-401, 444-447
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #9606 +/- ## =========================================== + Coverage 45.17% 59.26% +14.08% =========================================== Files 208 137 -71 Lines 8327 5565 -2762 Branches 1878 1501 -377 =========================================== - Hits 3762 3298 -464 + Misses 4118 1963 -2155 + Partials 447 304 -143 🚀 New features to boost your workflow:
|
Uh oh!
There was an error while loading. Please reload this page.
this avoids the weirdly double-nested queryFn naming
Summary by CodeRabbit
Refactor
Tests