🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Connecting the new Presentation view with related documents in the studio when using a cross-origin studio.

5 replies
Last updated: Dec 6, 2023
Is it currently possible to have the new Presentation view load the appropriate "Documents on this page" when the studio is cross origin? I'm using next.js and developing within local environment only so far, on ports :3000 for next and :3333 for studio. I seem to be able to link from a Document within Structure and view it in Presentation, it loads correctly. But when loading the Presentation directly it doesn't seem to map back the other way, i.e. it cant find any matching documents.
Dec 5, 2023, 4:25 AM
In other words, where is the logic that takes the current url in the presentation view, and triggers the studio to pull related documents in the side bar?
Digging through docs and source code, I cant find anything that explains how this is supposed to work.
Dec 5, 2023, 6:45 AM
Update - finally figured out that the "optional" useQuery hook is what connects the two, I think it would be great to document that the useQuery hook actually does more than just load live client-side data, but also facilitates that connection to list the related documents in the studio.
Dec 5, 2023, 7:38 AM
Thanks for this
user D
- we're currently improving the documentation and making some pretty good simplifications to the API surface. Much appreciated.
Dec 5, 2023, 10:39 PM
user Y
Dec 5, 2023, 10:39 PM
Good signal
user D
Dec 6, 2023, 8:40 AM

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?