Preview of JSON

Hi, the docu says under point 4 (Toolbar) the following:

It will show you a preview of the JSON response with Dev Mode.

Does someone know where to see the JSON response? I have a Free Plan and therefore no multiple environments, but somehow think this is not related to a Plan feature and should be possible to see.

Thanks,
Peter

Hi Peter,

Some of the difficulties surrounding Next.js and Previews is because of statically generate pages.

The edit button uses queries made to Prismic on the page to predict the main document and linked document, it also uses these queries to show the JSON preview that you mentioned above.

The issue is that because Next.js is statically generating the pages as HTML there are no queries being made for the edit button to use. This creates different issues in terms of previewing for Next.js we have some workarounds that we are trying to document, but the team plans to work on a prismic-next plugin in the new year which will make these workarounds unnecessary.

We have a workaround for getting the main document for the edit button & Dev Mode for our own projects. It involves doing a client-side query (using the useEffect hook) for the documents used on that page. This query is solely for the purpose of having the documents appear in the toolbar. You could do a similar query for everything to populate the Dev Mode tab.

Alternatively, you can use your API browser to see the JSON response for the content coming from your repo:

I will update the document you linked at the top as the information is misleading, I'm working hard at the minute to make this all clearer. Hopefully, the team can make this whole process easier in the future.

Thanks.

Hi Phil,

Thanks for the explanation and the options. I'm indeed using Postman with the Rest API to get insight, but i thought if I implement Preview, I would want to try to full implementation. I'll wait for the prismic-next plugin.

Thanks,
Peter

1 Like