Skip to content

docs(framework/vue/devtools): inline the toggle and 'onClose' handler in the 'Embedded Mode' example to match the other adapters#10856

Merged
sukvvon merged 1 commit into
mainfrom
docs/framework-vue-devtools-embedded-mode-inline-toggle
Jun 1, 2026
Merged

docs(framework/vue/devtools): inline the toggle and 'onClose' handler in the 'Embedded Mode' example to match the other adapters#10856
sukvvon merged 1 commit into
mainfrom
docs/framework-vue-devtools-embedded-mode-inline-toggle

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Jun 1, 2026

🎯 Changes

Simplify the Vue ## Embedded Mode example by inlining the toggleDevtools function and the onClose handler so the snippet stays focused on the state and template, matching how the React/Preact/Solid examples already work:

  • drop the named toggleDevtools function and inline @click="isOpen = !isOpen" on the button
  • use :onClose="() => (isOpen = false)" so the handler explicitly closes the panel (mirroring React's onClose={() => setIsOpen(false)}) instead of toggling, which more accurately reflects the prop's semantics
  • add a blank line between the imports and const isOpen = ref(false) so the locals are visually separated from the import block
 <script setup>
 import { ref } from 'vue'
 import { VueQueryDevtoolsPanel } from '@tanstack/vue-query-devtools'
-const isOpen = ref(false)
-function toggleDevtools() {
-  isOpen.value = !isOpen.value
-}
+
+const isOpen = ref(false)
 </script>

 <template>
   <h1>The app!</h1>
-  <button @click="toggleDevtools">
+  <button @click="isOpen = !isOpen">
     {{ isOpen ? 'Close' : 'Open' }} the devtools panel
   </button>
-  <VueQueryDevtoolsPanel v-if="isOpen" :onClose="toggleDevtools" />
+  <VueQueryDevtoolsPanel v-if="isOpen" :onClose="() => (isOpen = false)" />
 </template>

Follow-up to #10855 (which already aligned the state name and button label). The <script setup> + v-if + @click template syntax remain idiomatic Vue 3.

✅ 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
    • Improved the Vue devtools embedded mode code example with a simplified panel toggle implementation.

… in the 'Embedded Mode' example to match the other adapters
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1f1cbd2b-ca04-45ca-a292-2d8eaa63f7f0

📥 Commits

Reviewing files that changed from the base of the PR and between b1337cd and 53e683f.

📒 Files selected for processing (1)
  • docs/framework/vue/devtools.md

📝 Walkthrough

Walkthrough

The Vue devtools documentation is updated to simplify the Embedded Mode example. The code snippet removes a separate toggleDevtools() helper function and instead toggles the isOpen ref directly in the button click handler, with an inline onClose callback that closes the panel.

Changes

Vue Devtools Documentation

Layer / File(s) Summary
Embedded Mode example refactoring
docs/framework/vue/devtools.md
The Embedded Mode code snippet is simplified by removing the standalone toggle function and consolidating open/close logic: the button now toggles isOpen directly in its @click handler, and the devtools panel uses an inline onClose callback to set isOpen back to false.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • TanStack/query#10853: Both PRs update the Embedded Mode Vue devtools example to use local isOpen state with an inline onClose callback instead of a separate toggle helper.
  • TanStack/query#10854: Both PRs modify the same docs/framework/vue/devtools.md Embedded Mode section with updates to the example's embedded devtools logic.
  • TanStack/query#10855: Both PRs modify the same Embedded Mode Vue devtools documentation snippet, updating how the open/close state is handled.

Poem

🐰 A toggle that once stood alone,
Now nestled in the click zone,
Callbacks inline, so clean and neat,
The Vue devtools example is sweet!
Less code to teach, more beauty shown.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: inlining the toggle and onClose handler in the Vue Embedded Mode example to align with other adapters.
Description check ✅ Passed The description follows the template structure with completed sections, includes detailed rationale with code diff, and confirms both required checklist items are marked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/framework-vue-devtools-embedded-mode-inline-toggle

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jun 1, 2026

View your CI Pipeline Execution ↗ for commit 53e683f

Command Status Duration Result
nx run-many --target=build --exclude=examples/*... ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-01 08:05:04 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

🚀 Changeset Version Preview

2 package(s) bumped directly, 23 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/lit-query 0.2.6 → 0.2.7 Changeset
@tanstack/query-devtools 5.100.14 → 5.100.15 Changeset
@tanstack/angular-query-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/angular-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/eslint-plugin-query 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/query-async-storage-persister 5.100.14 → 5.100.15 Dependent
@tanstack/query-broadcast-client-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/query-core 5.100.14 → 5.100.15 Dependent
@tanstack/query-persist-client-core 5.100.14 → 5.100.15 Dependent
@tanstack/query-sync-storage-persister 5.100.14 → 5.100.15 Dependent
@tanstack/react-query 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-next-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/svelte-query 6.1.33 → 6.1.34 Dependent
@tanstack/svelte-query-devtools 6.1.33 → 6.1.34 Dependent
@tanstack/svelte-query-persist-client 6.1.33 → 6.1.34 Dependent
@tanstack/vue-query 5.100.14 → 5.100.15 Dependent
@tanstack/vue-query-devtools 6.1.33 → 6.1.34 Dependent

@sukvvon sukvvon self-assigned this Jun 1, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 1, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 53e683f

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

size-limit report 📦

Path Size
react full 12.11 KB (0%)
react minimal 9.08 KB (0%)

@sukvvon sukvvon merged commit dcc4a16 into main Jun 1, 2026
11 of 12 checks passed
@sukvvon sukvvon deleted the docs/framework-vue-devtools-embedded-mode-inline-toggle branch June 1, 2026 08:07
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.

1 participant