sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Open up previewUrl access

Open markomitranic opened this issue 4 months ago • 0 comments

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.

https://github.com/sanity-io/sanity/blob/next/packages/sanity/src/structure/panes/document/DocumentPaneProvider.tsx#L191

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();

markomitranic avatar Apr 09 '24 09:04 markomitranic