Closed phmasek closed 1 year ago
Thanks for your efforts here!
However, defaultDocumentNode
contains the getClient()
function inside the second context
parameter. So you could pass the client to your function like this:
export const defaultDocumentNode: DefaultDocumentNodeResolver = (
S,
context
) => {
const client = context.getClient({apiVersion: `2022-11-24`})
return S.document().views([
S.view.form(),
S.view
.component(Iframe)
.options({
url: (doc) => getPreviewUrl(doc, client),
})
.title('Preview'),
])
}
Would this solve what you're trying to do?
Aha! That is a much better solution of course. Thank you @SimeonGriggs
The way we are using the client has changed from v2 to v3. Therefore it would be good to provide a client for when resolving the production URL similarly to how you receive context in the document API.