test(vue-query): add regression tests for suspense release on programmatic 'setQueryData' - #11249
Conversation
…matic 'setQueryData'
|
View your CI Pipeline Execution ↗ for commit b019312
☁️ Nx Cloud last updated this comment at |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughAdded Vue suspense tests that use Vitest fake timers. The tests verify resolution after ChangesVue suspense behavior
Estimated code review effort: 3 (Moderate) | ~15 minutes Merge Risk: ⚪ Minimal · up to This PR adds localized regression coverage without changing published runtime behavior, and no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
🚀 Changeset Version Preview10 package(s) bumped directly, 15 bumped as dependents. 🟨 Minor bumps
🟩 Patch bumps
|
size-limit report 📦
|
🎯 Changes
Port the vue-query counterpart of the regression tests added in #11036 (react-query). The underlying fix lives in
packages/query-core/src/queryObserver.ts(fetchOptimistic), andvue-query's.suspense()helper (useBaseQuery.ts) callsobserver.fetchOptimistic(...)directly, so it already gets the runtime behavior for free — this PR only adds test coverage:should release suspense when setQueryData is called while fetch is in-flightshould release suspense when streamedQuery receives first chunkTwo scenarios from the react-query version were deliberately not ported:
.suspense()only callsfetchOptimisticwhenoptimisticResult.isStaleis true; with data already cached and fresh, it resolves via a different branch and never reaches the fixed code path, so the test would pass regardless of the fix.query.state.data !== undefinedguard removed fromfetchOptimistic, i.e. it doesn't actually exercise the guard in vue's.suspense()shape. Left out rather than shipping a test that doesn't test anything.Both included tests were verified against a reverted (pre-#11036)
fetchOptimisticlocally and failed as expected (timeout) before being confirmed passing against the current code.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit