CoursesBetween GROQ and a hard placeThe Vision Tool
Certification
Sanity developer certification
Track
Sanity developer essentials

Between GROQ and a hard place

Lesson
2

The Vision Tool

Log in to mark your progress for each Lesson and Task

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:

Open a terminal and install the plugin package
npm install @sanity/vision
In your Studio config, import the visionTool() function
./sanity.config.ts
import { visionTool } from "@sanity/vision";
Add it to the config's plugins array
./sanity.config.ts
plugins: [
// ... 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.

You have 3 uncompleted tasks in this lesson
0 of 3