Repository navigation
fix(query-core): exclude queries without data from isStatic - #12497
Conversation
🦋 Changeset detectedLatest commit: 19c0830 The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
View your CI Pipeline Execution ↗ for commit 19c0830
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview1 package(s) bumped directly, 23 bumped as dependents. 🟩 Patch bumps
|
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Static query data check and reset behavior packages/query-core/src/query.ts, packages/query-core/src/__tests__/queryClient.test.tsx, .changeset/static-query-without-data.md |
Query.isStatic() returns false when query data is undefined. Tests cover refetching after invalidation or reset when data is absent, and restoring configured initial data without fetching. The changeset describes refetching static queries without data after reset, invalidation, or explicit refetch. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: sukvvon
Merge Risk: 
Minimal · up to 19c08
-
Static queries without data can refetch after a reset or failed initial fetch. No merge-blocking risk is identified.
Pre-merge checks: 
5
-
Full details: Description check
-
Explanation
The description explains the change, motivation, implementation approach, tests, and release impact. The AI contribution policy checklist item remains unchecked, but the required sections are otherwise complete.
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
size-limit report 📦
|
…anStack#12497)" This reverts commit 969e580.
…anStack#12497)" This reverts commit 969e580.
…anStack#12497)" This reverts commit 969e580.
🎯 Changes
query.isStatic()should return false if the query has no data. This lets active static queries refetch after reset or a failed first fetch.Alternative to #12122. The data check belongs in
isStatic(), sorefetchQueriescan keep its existing filter.isStaleByTimekeeps its per-observer check.Tests cover reset, invalidation after a failed first fetch, and reset with
initialData: 0. Both regression tests failed before the fix.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit