sanity
sanity copied to clipboard
Open up previewUrl access
Is your feature request related to a problem? Please describe.
There is a productionUrl
config option that lets us define our own route resolution logic, as well as our own draft API location across multiple domains or even server actions.
The value is stored within the document context and we may import it and use it. In the Sanity code however, there is a 2 year old comment that says that this should remain hidden, signaling that it is unstable - which forces plugin authors (even yourselves, sanity, fx within preview plugins) from using it, so people start making their own, parallel, route resolution systems.
Describe the solution you'd like Perhaps a different comment with a clarification, or removal of the weird comment, or a deprecation in favour of a different system that is being considered?
Describe alternatives you've considered
We can currently use it, as it is exposed. I use it as such:
import { useDocumentPane } from "sanity/structure";
const { previewUrl } = useDocumentPane();