Skip to content
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

Updated getInitialProps to getServerSideProps #11

Conversation

shaswatsaxena
Copy link

  • Updated dependencies
  • With nextjs 9.3 getInitialProps has been replaced by getServerSideProps.
  • Prismic logo image path fixed

@osamaaamer95
Copy link

Shouldn't this use getStaticProps? Rationale here.

@hypervillain
Copy link
Contributor

You're right @osamaaamer95, getStaticProps makes more sense here.
Want to take care of it?

@osamaaamer95
Copy link

@shaswatsaxena how about it?

@shaswatsaxena
Copy link
Author

@osamaaamer95 Sure, go ahead. I couldn't get the current previews setup to work with getStaticProps.

@hypervillain
Copy link
Contributor

I think this ressource could be of great help in your situation:
https://nextjs.org/docs/advanced-features/preview-mode

See in particular the "Fetch preview data" section, where the preview logic would be specific to Prismic. I'll take a look in the coming days but feel free to experiment 👍

@hypervillain
Copy link
Contributor

I found a working example in the Next.js examples folder: https://github.com/zeit/next.js/tree/canary/examples/cms-prismic

It shouldn't be too hard to add the api routes

@hypervillain
Copy link
Contributor

Hey again 👋
I made the new getStaticProps work with Prismic but it clashes a bit with the Toolbar. I'm trying to understand what can be done there but will push something in the meantime. Thank you for your patience 😊

@phillysnow phillysnow closed this Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants