Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
TkDodo wants to merge 1 commit into main
base: main
Choose a base branch
Loading
from feature/streamFn

Conversation

Copy link
Collaborator

@TkDodo TkDodo commented Sep 1, 2025
edited by coderabbitai bot
Loading

this avoids the weirdly double-nested queryFn naming

Summary by CodeRabbit

  • Refactor

    • Renamed the streamedQuery option from "queryFn" to "streamFn". Functionality and streaming behavior remain unchanged. Update integrations to use "streamFn".
  • Tests

    • Updated streamedQuery test cases to reflect the new "streamFn" option name.

this avoids the weirdly double-nested queryFn naming
Copy link

coderabbitai bot commented Sep 1, 2025
edited
Loading

Walkthrough

Renames the streamedQuery option from queryFn to streamFn across the implementation and tests. Internal logic, control flow, and streaming semantics remain the same.

Changes

Cohort / File(s) Summary
Public API rename
packages/query-core/src/streamedQuery.ts
Renamed option property queryFnstreamFn; updated internal invocation to use streamFn(context). No other behavior changes.
Tests update for API rename
packages/query-core/src/__tests__/streamedQuery.test.tsx
Updated all test cases to use streamFn instead of queryFn; test logic and expectations unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my ears at streams that flow,
A tiny rename—onward we go!
From queryFn to streamFn’s gleam,
Same currents hum beneath the stream.
I thump, approve, then hop away—
The code still sings, just named today. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/streamFn

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

nx-cloud bot commented Sep 1, 2025
edited
Loading

View your CI Pipeline Execution ↗ for commit 98b68c2

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

☁️ Nx Cloud last updated this comment at 2025年09月01日 11:44:46 UTC

Copy link

pkg-pr-new bot commented Sep 1, 2025

More templates
@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

Copy link

github-actions bot commented Sep 1, 2025

Sizes for commit 98b68c2:

Branch Bundle Size
Main
This PR

Copy link

@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.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 0650eaf and 98b68c2.

📒 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 remaining queryFn usage; callers must switch to streamFn. 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

Copy link

codecov bot commented Sep 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.26%. Comparing base (0650eaf) to head (98b68c2).

Additional details and impacted files

Impacted file tree graph

@@ 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 
Components Coverage Δ
@tanstack/angular-query-devtools-experimental ∅ <ø> (∅)
@tanstack/angular-query-experimental 87.00% <ø> (ø)
@tanstack/eslint-plugin-query ∅ <ø> (∅)
@tanstack/query-async-storage-persister 43.85% <ø> (ø)
@tanstack/query-broadcast-client-experimental 24.39% <ø> (ø)
@tanstack/query-codemods ∅ <ø> (∅)
@tanstack/query-core 97.41% <100.00%> (ø)
@tanstack/query-devtools 3.48% <ø> (ø)
@tanstack/query-persist-client-core 79.47% <ø> (ø)
@tanstack/query-sync-storage-persister 84.61% <ø> (ø)
@tanstack/query-test-utils ∅ <ø> (∅)
@tanstack/react-query 95.95% <ø> (ø)
@tanstack/react-query-devtools 10.00% <ø> (ø)
@tanstack/react-query-next-experimental ∅ <ø> (∅)
@tanstack/react-query-persist-client 100.00% <ø> (ø)
@tanstack/solid-query 78.13% <ø> (ø)
@tanstack/solid-query-devtools ∅ <ø> (∅)
@tanstack/solid-query-persist-client 100.00% <ø> (ø)
@tanstack/svelte-query 87.58% <ø> (ø)
@tanstack/svelte-query-devtools ∅ <ø> (∅)
@tanstack/svelte-query-persist-client 100.00% <ø> (ø)
@tanstack/vue-query 71.10% <ø> (ø)
@tanstack/vue-query-devtools ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /