Vision is a plugin for Sanity Studio for testing GROQ queries. It features:
- GROQ syntax highlighting so that the query is easier to read.
- Parsed response that's more convenient to navigate and explore.
- Switch between datasets
- Listening for real-time updates
npm install --save @sanity/vision
// `sanity.config.ts` / `sanity.config.js`:
import {createConfig} from 'sanity'
import {vision} from '@sanity/vision'
export default createConfig({
// ...
plugins: [
vision({
// Note: These are both optional
defaultApiVersion: 'v2021-10-21',
defaultDataset: 'some-dataset',
}),
],
})
If you only want the tool available in development (eg not in deployed studios), you can import and use the isDev
constant from the sanity
package:
// `sanity.config.ts` / `sanity.config.js`:
import {createConfig, isDev} from 'sanity'
import {vision} from '@sanity/vision'
const devOnlyPlugins = [vision()]
export default createConfig({
// ...
plugins: [
// ... your other plugins here ...
...(isDev ? devOnlyPlugins : []),
],
})
MIT-licensed. See LICENSE.