Skip to content

perf(query-core): Reuse refetch interval resolver 🤖🤖🤖 - #11332

Open
scttcper wants to merge 4 commits into
TanStack:mainfrom
scttcper:scttcper/reuse-refetch-resolver
Open

perf(query-core): Reuse refetch interval resolver 🤖🤖🤖#11332
scttcper wants to merge 4 commits into
TanStack:mainfrom
scttcper:scttcper/reuse-refetch-resolver

Conversation

@scttcper

@scttcper scttcper commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🎯 Changes

Reuse resolveQueryValue for QueryObserver refetch intervals, matching the option resolution cleanup from #11302 and removing the duplicate function branch.

Extends the disabled observer test to cover refetch timers. Existing behavioral coverage continues to prove numeric intervals, interval changes including stopping on false, function intervals receiving the current Query, and server timer behavior.

With Vite 8.2.2 and Oxc minification, both scenarios saved 76 B minified. Query-only saved 13 B gzip / 9 B Brotli; full-SPA saved 12 B gzip / 3 B Brotli. A second run reproduced every compressed result.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Bug Fixes

    • Disabled observers no longer schedule unnecessary timeout or interval timers.
    • Refetch intervals continue to resolve correctly, including dynamically configured intervals.
  • Performance

    • Reduced bundle size by reusing shared query option resolution logic for refetch intervals.

Reuse the generic query option resolver added in TanStack#11302 for refetch intervals. Keeps callback and nullish fallback behavior while dropping the duplicate branch.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a00d65db-20f1-4832-b1e3-025e85f7685a

📥 Commits

Reviewing files that changed from the base of the PR and between b53bddb and f0b22dd.

📒 Files selected for processing (3)
  • .changeset/lazy-cats-poll.md
  • packages/query-core/src/__tests__/queryObserver.test.tsx
  • packages/query-core/src/queryObserver.ts
 _________________________________________________________________
< Granted, I'm not human, but I still know when your code is bad. >
 -----------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ 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.

Drop the cast-heavy timer spy coverage and keep the existing behavioral tests plus the disabled observer timer assertion.

Co-authored-by: OpenAI Codex <noreply@openai.com>
@nx-cloud

nx-cloud Bot commented Aug 30, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit f0b22dd

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 5m 29s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-30 14:35:49 UTC

@pkg-pr-new

pkg-pr-new Bot commented Aug 30, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: f0b22dd

@TkDodo
TkDodo marked this pull request as ready for review August 30, 2026 14:42
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.

2 participants