Skip to content

Conversation

@sybers
Copy link
Contributor

@sybers sybers commented Nov 25, 2025

🎯 Changes

This example is written in Javascript, and the fact that todoId is a Ref is a bit hard to identify.

I propose to migrate this example to Typescript, with an import to Vue's Ref type and make the parameter to the example composable explicit.

There are more docs that could be improved this way, if it suits you I could also make the changes to these docs :)

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 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

  • Documentation
    • Updated Vue query keys guide to TypeScript examples.
    • Added Vue Ref type annotation and import for clearer examples.
    • Example function signature now accepts a Ref and demonstrates using .value when accessing the ID.
    • Improved type-safety and clarity in the documentation samples.

✏️ Tip: You can customize this high-level summary in your review settings.

This example is written in Javascript, and the fact that `todoId` is a `Ref` is a bit hard to identify.

I propose to migrate this example to Typescript, with an import to Vue's Ref type and make the parameter to the example composable explicit.

There are more docs that could be improved this way, if it suits you I could also make the changes to these docs :)
@changeset-bot
Copy link

changeset-bot bot commented Nov 25, 2025

⚠️ No Changeset found

Latest commit: f988098

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Nov 25, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

Walkthrough

Docs example changed from JavaScript to TypeScript: useTodos now accepts a Ref<string> and the example uses todoId.value inside the query key and query function.

Changes

Cohort / File(s) Summary
Vue Query Keys Documentation
docs/framework/vue/guides/query-keys.md
Convert fenced example from javascripttypescript; add import type { Ref } from 'vue'; change function useTodos(todoId)function useTodos(todoId: Ref<string>); use todoId as a Ref in queryKey and queryFn (use todoId.value).

Sequence Diagram(s)

sequenceDiagram
    participant Component as Vue Component
    participant Hook as useTodos(todoId: Ref<string>)
    participant Query as useQuery
    participant Fetch as fetchTodoById(id)

    Component->>Hook: call useTodos(todoIdRef)
    Hook->>Query: init with queryKey [ 'todos', todoIdRef ]
    Note over Query,Hook: queryFn reads todoIdRef.value
    Query->>Fetch: fetchTodoById(todoIdRef.value)
    Fetch-->>Query: todo data
    Query-->>Component: data / status
Loading

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Check TypeScript import and Ref<string> annotation
  • Verify .value usage in queryKey and queryFn is correct and consistent with Vue 3 patterns

Possibly related PRs

Suggested reviewers

  • TkDodo

Poem

🐰 A tiny Ref held snug and bright,

I hop with types in morning light.
.value I nibble, queries sing,
Vue and TypeScript—what joy they bring! 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change—converting a Vue query keys example from JavaScript to TypeScript.
Description check ✅ Passed The description includes all required sections with substantive content: changes are clearly explained with motivation, both checklist items are marked as completed, and release impact is appropriately identified as docs-only.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ed5007 and f988098.

📒 Files selected for processing (1)
  • docs/framework/vue/guides/query-keys.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/framework/vue/guides/query-keys.md
⏰ 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

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 and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Nov 26, 2025

View your CI Pipeline Execution ↗ for commit f988098

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

☁️ Nx Cloud last updated this comment at 2025-11-26 12:02:56 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 26, 2025

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: f988098

@DamianOsipiuk DamianOsipiuk merged commit 8b38734 into TanStack:main Nov 26, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants