Difficulty accessing unpublished references in Sanity.io

2 replies
Last updated: Dec 12, 2023
Hello,
Can be pulled an strengthenOnPublish?

Example in the ss.


I want to access the reference but because is _strengthenOnPublish I cannot, (is not published yet). Does anyone know if can be possible?

The query to see the properties:


*[_id == 'drafts.11a505c1-2e8c-4276-af96-9e05535f77c3' || _id == "11a505c1-2e8c-4276-af96-9e05535f77c3"] {

slug,

modules[_ref == "a118f6b8-1126-4e9b-96de-e4fb4d28be00"] {

...

}

}

When I try to use -> for the reference I cannot get it.
Example:


*[_id == 'drafts.11a505c1-2e8c-4276-af96-9e05535f77c3' || _id == "11a505c1-2e8c-4276-af96-9e05535f77c3"] {

slug,

modules[_ref == "a118f6b8-1126-4e9b-96de-e4fb4d28be00"] -> {

...

}

}

Any thoughts?
Dec 12, 2023, 7:21 PM
The
->
operator does not work on unpublished references. You would need to perform a subquery to get its values.
Dec 12, 2023, 7:40 PM
I see, thank you
user M
Dec 12, 2023, 7:40 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?