Unlock seamless workflows and faster delivery with our latest releases – get the details

Why would a Query Work in the Vision Plugin from the Dashboard, but not in the Queries.js File?

2 replies
Last updated: Jul 23, 2022
Hey! Does anyone know why a query would work in the Vision plugin from the dashboard, but not in a site's
queries.js
file? For example, I'm trying to query all documents that contain an object of a specific type:

*[_type == 'page' && modules[]._type == 'diningMenu']{

'slug': slug.current,

title

}

This returns the correct documents in the vision tab, but returns an empty array In my site data. Should I be writing the query differently or is there something I'm missing?
Jul 23, 2022, 12:57 AM
Looks like I needed to use
match
instead of
==
. Is there a reason why this would work in the vision plugin still?
Jul 23, 2022, 1:21 AM
It’s most likely due to different groq versions. Which version do you use in Vision and which one in your app?
Jul 23, 2022, 7:46 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?