feat(vue-query): add usePrefetchQuery and usePrefetchInfiniteQuery#10371
feat(vue-query): add usePrefetchQuery and usePrefetchInfiniteQuery#10371thalassophilia wants to merge 1 commit intoTanStack:mainfrom
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughTwo new Vue framework documentation reference files are introduced for Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/vue-query/src/usePrefetchInfiniteQuery.ts (1)
57-113: Consider extracting shared prefetch internals to avoid drift
isGetter, dev-scope warning, option resolution, deep unref clone, and state-guard logic are duplicated withpackages/vue-query/src/usePrefetchQuery.ts. A small internal helper would reduce long-term divergence risk.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/vue-query/src/usePrefetchInfiniteQuery.ts` around lines 57 - 113, The prefetch logic in usePrefetchInfiniteQuery (isGetter, dev-scope warning, option resolution, cloneDeepUnref, state-guard and prefetch call using client.getQueryState + prefetchInfiniteQuery inside watchEffect) is duplicated with usePrefetchQuery; extract a small internal helper (e.g., prefetchHelper or resolveAndPrefetch) that accepts the options ref/getter, the client, and a prefetch function (prefetchQuery vs prefetchInfiniteQuery) to centralize: move the dev-scope warning, isGetter check, resolution/unref+cloneDeepUnref, and guarded getQueryState check into that helper, then call it from both usePrefetchQuery and usePrefetchInfiniteQuery passing the appropriate prefetch function to avoid future drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/vue-query/src/usePrefetchInfiniteQuery.ts`:
- Around line 57-113: The prefetch logic in usePrefetchInfiniteQuery (isGetter,
dev-scope warning, option resolution, cloneDeepUnref, state-guard and prefetch
call using client.getQueryState + prefetchInfiniteQuery inside watchEffect) is
duplicated with usePrefetchQuery; extract a small internal helper (e.g.,
prefetchHelper or resolveAndPrefetch) that accepts the options ref/getter, the
client, and a prefetch function (prefetchQuery vs prefetchInfiniteQuery) to
centralize: move the dev-scope warning, isGetter check,
resolution/unref+cloneDeepUnref, and guarded getQueryState check into that
helper, then call it from both usePrefetchQuery and usePrefetchInfiniteQuery
passing the appropriate prefetch function to avoid future drift.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b0c099a0-e4b8-4a90-a62c-afacf87ccf19
📒 Files selected for processing (11)
.changeset/wild-planes-report.mddocs/config.jsondocs/framework/vue/reference/usePrefetchInfiniteQuery.mddocs/framework/vue/reference/usePrefetchQuery.mdpackages/vue-query/src/__tests__/usePrefetchInfiniteQuery.test-d.tspackages/vue-query/src/__tests__/usePrefetchInfiniteQuery.test.tspackages/vue-query/src/__tests__/usePrefetchQuery.test-d.tspackages/vue-query/src/__tests__/usePrefetchQuery.test.tspackages/vue-query/src/index.tspackages/vue-query/src/usePrefetchInfiniteQuery.tspackages/vue-query/src/usePrefetchQuery.ts
037ee8e to
a158029
Compare
🎯 Changes
Add
usePrefetchQueryandusePrefetchInfiniteQueryto@tanstack/vue-query.This PR:
usePrefetchQueryandusePrefetchInfiniteQueryto the Vue adapter✅ Checklist
pnpm run test:pr.🚀 Release Impact
Validated with:
npx nx run @tanstack/vue-query:test:libnpx nx run @tanstack/vue-query:test:eslintSummary by CodeRabbit
usePrefetchQueryusePrefetchInfiniteQuery