
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeI can see exactly what's happening! The issue is related to the recent API version 2025-02-19 update, specifically the default perspective change from raw to published.
Your query categories[]._ref == '${category}' is likely returning empty results because the API now defaults to perspective=published instead of perspective=raw. This means you're only seeing published documents, not drafts.
According to the API version 2025-02-19 changelog, the most significant breaking change is:
The default perspective has switched from
rawtopublished. This affects the/queryendpoint and GraphQL queries.
With perspective=published, you only get published documents. With perspective=raw, you get drafts, published documents, AND the new versions.** documents (for Content Releases).
You have two main options:
1. Explicitly set the perspective parameter in your query request:
// Add perspective=raw to your query parameters
const query = `*[(_type== 'event' || _type== 'news' || _type== 'resource') && categories[]._ref == $category][0...12] { ... }`
const params = { category: 'your-category-id' }
const result = await client.fetch(query, params, { perspective: 'raw' })2. Use perspective=previewDrafts if you want drafts to take precedence over published versions (this is often what you want in preview contexts).
The 2025-02-19 version also:
versions.** prefixed documents for Content ReleasesThe full API versioning documentation explains how dated API versions work and how to opt into specific versions. If you haven't explicitly set an API version in your client configuration, you might have been automatically upgraded to the latest version.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store