-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support custom exit preview url when closing using the toolbar #64
Comments
As far as I can tell, using the toolbar makes the preview session unusable on nextjs. If we only close the next preview session, it doesn't close the prismic preview session and vice-versa. Is there a workaround in the meantime or a best practice for this? |
It seems like the Next.js demo repo doesn't use the Prismic toolbar at all so I guess the best practice is just not to use it. |
I think that it would be awesome if the Prismic toolbar could handle this in the future. As a workaround for now, here's what I did when working on the Prismic Documentation (built with Next.js): I created an exit preview button that displays when in Preview mode. When you click on it, it will exit the preview mode and redirect back to the page you were on when you clicked the button. Here is a simple version of an ExitPreviewButton component
Then here is the
|
Thanks @levimykel, were you using the Toolbar in addition to this? |
@justintemps Yeah, I do use the Toolbar in addition. It means that you need to click the close preview button, then click to close the toolbar as well. I hope this can eventually be built into the toolbar so that previews can be closed with a single click, but hopefully this will do as a workaround for now. |
@levimykel It would be amazing to have a Toolbar component that could take onExit handler for that. |
When integrating with Next.js we have to define a local cookie so that Next.js knows it should bypass any statically generated files and preform the request to Prismic API. This works as expected with the correct preview url defined in Prismic settings.
However when closing the preview using the toolbar, this only clears the cookie on prismic side, leaving the cookie that Next.js defines to be able to preview.
I'd like to request the toolbar to support a setting that allows us to define our app exit url so that we can clear the local cookie and exit the preview correctly
The text was updated successfully, but these errors were encountered: