😎 Discover cool tips and tricks for customization in our next Developer Deep Dive virtual event - sign up now!

Why is GROQ Query Returning an Empty Set in my App but not in the Vision Plugin?

12 replies
Last updated: Apr 7, 2022
hi — can anyone think of why my GROQ query would be returning an empty set in my app but not in the Vision Plugin? My query is
*[ _type == "exhibition" && (!isUpcoming || isUpcoming == null)]
. The query works in the client, returning “exhibitions” if I don’t include the “isUpcoming” conditionals. But then returns an empty set as soon as I add the conditional
Apr 7, 2022, 5:50 PM
Are they both using the same api version?
Apr 7, 2022, 5:51 PM
that’s a good question, how would I check this?
Apr 7, 2022, 5:52 PM
in Vision you select it at the top, in your client you specify it as an option, if not it defaults to v1 (I think).
Apr 7, 2022, 5:53 PM
It’ll be in your api request urls in your app (where you initiate the client if you’re using one https://github.com/sanity-io/client#api )
And in the vision plugin it should show near the top
Apr 7, 2022, 5:53 PM
Another thing is that perhaps one request happens authenticated, and the other un-authenticated, and that that influences drafts vs no drafts or something like that
Apr 7, 2022, 5:54 PM
okay thanks for the help! turns out I wasn’t explicitly stating the apiVersion and changing it to the one in Vision fixed the problem
Apr 7, 2022, 5:56 PM
It’ll be in your api request urls in your app (where you initiate the client if you’re using one https://github.com/sanity-io/client#api )
And in the vision plugin it should show near the top
Apr 7, 2022, 5:53 PM
that’s a good question, how would I check this?
Apr 7, 2022, 5:52 PM
Are they both using the same api version?
Apr 7, 2022, 5:51 PM
Another thing is that perhaps one request happens authenticated, and the other un-authenticated, and that that influences drafts vs no drafts or something like that
Apr 7, 2022, 5:54 PM
okay thanks for the help! turns out I wasn’t explicitly stating the apiVersion and changing it to the one in Vision fixed the problem
Apr 7, 2022, 5:56 PM
in Vision you select it at the top, in your client you specify it as an option, if not it defaults to v1 (I think).
Apr 7, 2022, 5:53 PM

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?