The Vision Tool
Vision is a plugin bundled with Sanity Studio that allows you to write GROQ queries against the current Project ID and Dataset.
Note: Vision uses your logged-in credentials to perform authenticated requests. In most setups, your front end client makes unauthenticated queries of publicly queryable documents. This explains why you may see draft documents in Vision and not in your front end.
Check to see if visionTool()
is already listed among your Studio's plugins in your sanity.config.ts
file. If not, you'll need to install it:
We'll use the npm package readme for instructions on how to install it into the Studio:
npm install @sanity/vision
visionTool()
functionimport { visionTool } from "@sanity/vision";
plugins
arrayplugins: [ // ... all your other plugins visionTool()],
You should now see at least two Tools in your Studio: Structure and Vision.
Now, you have a playground prepared to run queries against the current dataset.
Let's GROQ.