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

Finding Sections to Add to a Document Using the Reference Type Schema

2 replies
Last updated: Apr 30, 2021
Hey everyone! I need some help here. My client is having a really hard time finding sections to add to a document using the reference type schema. One of the biggest improvements she would like to have is for the results to at least be alphabetized. I know there is an "option.filter" available for the reference schema but can't find any examples of how to use it. Thanks in advance for any help!
Apr 29, 2021, 7:28 PM
option.filter
will let you constrain your search, but just the filter (no projections,
order()
, etc.). I tried pulling in the documents using
client.fetch()
inside the filter function and sorting them, which works, but then applying them through
params
had no effect on the order of documents in the dropdown. I think you might need to go with a custom input component to get an alphabetized reference dropdown.
Apr 29, 2021, 9:14 PM
thanks!
Apr 30, 2021, 3:31 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?