Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(vue): up-to-date devtools information #7578

Merged
merged 5 commits into from
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 25 additions & 15 deletions docs/framework/vue/devtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,10 @@ Wave your hands in the air and shout hooray because Vue Query comes with dedicat

When you begin your Vue Query journey, you'll want these devtools by your side. They help visualize all of the inner workings of Vue Query and will likely save you hours of debugging if you find yourself in a pinch!

The only thing you need to do is to install the official **[Vue Devtools](https://devtools.vuejs.org/guide/installation.html)**.

Vue Query will seamlessly integrate with the official devtools, adding custom inspector and timeline events.
Devtool code will be treeshaken from production bundles by default.

## Component based Devtools (Vue 3)

You can embeed devtools component into your page by using dedicated package.
Component based devtools are using the same framework-agnostic implementation, have more features and are updated more frequently.
You can directly integrate the devtools component into your page using a dedicated package.
Component-based devtools use a framework-agnostic implementation and are always up-to-date.

The devtools component is a separate package that you need to install:

Expand Down Expand Up @@ -49,19 +44,34 @@ import { VueQueryDevtools } from '@tanstack/vue-query-devtools'
### Options

- `initialIsOpen: Boolean`
- Set this `true` if you want the dev tools to default to being open
- Set this `true` if you want the dev tools to default to being open.
- `buttonPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right"`
- Defaults to `bottom-right`
- The position of the React Query logo to open and close the devtools panel
- Defaults to `bottom-right`.
- The position of the React Query logo to open and close the devtools panel.
- `position?: "top" | "bottom" | "left" | "right"`
- Defaults to `bottom`
- The position of the React Query devtools panel
- `client?: QueryClient`,
- Defaults to `bottom`.
- The position of the React Query devtools panel.
- `client?: QueryClient`
- Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.
- `errorTypes?: { name: string; initializer: (query: Query) => TError}`
- Use this to predefine some errors that can be triggered on your queries. Initializer will be called (with the specific query) when that error is toggled on from the UI. It must return an Error.
- Use this to predefine some errors that can be triggered on your queries. The initializer will be called (with the specific query) when that error is toggled on from the UI. It must return an Error.
- `styleNonce?: string`
- Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
- `shadowDOMTarget?: ShadowRoot`
- Default behavior will apply the devtool's styles to the head tag within the DOM.
- Use this to pass a shadow DOM target to the devtools so that the styles will be applied within the shadow DOM instad of within the head tag in the light DOM.
- Use this to pass a shadow DOM target to the devtools so that the styles will be applied within the shadow DOM instead of within the head tag in the light DOM.

## Traditional Devtools

Vue Query will seamlessly integrate with the [Official Vue devtools](https://github.com/vuejs/devtools-next), adding custom inspector and timeline events.
Devtool code will be treeshaken from production bundles by default.

To make it work, you only need to enable it in the plugin options:

```ts
app.use(VueQueryPlugin, {
enableDevtoolsV6Plugin: true
})
```

Both v6 and v7 versions of devtools are supported.
Loading