Issue with filtering documents by type in Sanity.io
I appreciate you sharing the issue you're experiencing with documentList().filter(). This is an interesting behavior that deserves a thorough investigation.
Based on the official Structure Builder documentation, the filter() method accepts "any GROQ filter" with some limitations: it "does not support joins, since they operate on individual documents, and will ignore order-clauses and projections."
However, the documentation doesn't explicitly mention a limitation with OR conditions for multiple _type values. The behavior you're describing—where only the first type in an OR expression appears—isn't documented as expected behavior.
Troubleshooting Steps
First, try the in operator syntax:
documentList().filter('_type in ["type1", "type2"]')This is the more idiomatic GROQ syntax for checking multiple values and may work better than the || operator in this context.
If that doesn't work, verify your filter is being applied:
Check your browser's network tab to see what query is actually being sent to Sanity. This can help determine whether the issue is with how the filter is constructed or how it's being rendered in the UI.
Alternative Approaches
If the filter continues to show only one type, here are some reliable workarounds:
Option 1: Separate lists in the same pane
S.list()
.title('Combined Types')
.items([
S.documentListItem()
.title('Type 1')
.schemaType('type1')
.child(S.documentList().filter('_type == "type1"')),
S.documentListItem()
.title('Type 2')
.schemaType('type2')
.child(S.documentList().filter('_type == "type2"')),
])Option 2: Use documentTypeListItem() for each type
S.list()
.title('My Content')
.items([
S.documentTypeListItem('type1'),
S.documentTypeListItem('type2'),
])Option 3: Custom component with manual GROQ query
If you need a truly unified list, create a custom component view that queries for multiple types directly using the Sanity client.
Reporting the Issue
Since this behavior isn't documented and seems unexpected, I'd recommend reporting it in the Sanity community Slack or as a GitHub issue on the sanity-io/sanity repository. Include your specific filter expression and the observed behavior so the team can investigate whether this is a bug or an undocumented limitation that should be clarified in the docs.
Sanity – Build the way you think, not the way your CMS thinks
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.