strapi / strapi-starter-next-ecommerce

Strapi Starter Next.js E-commerce
strapi-starter-next-ecommerce.strapijs.vercel.app
MIT License
215 stars 72 forks source link

Question: why not use getServerSideProps()? #19

Closed k-funk closed 2 years ago

k-funk commented 3 years ago

I'm currently investigating if Strapi+NextJS will meet my needs.

I noticed that this starter uses Server Side Generation (SSG) getStaticProps, rather then Server Side Rendering (SSR) getServerSideProps. Part of the benefit of using a CMS is to have dynamic content/urls, that non-technical people can update. Given that, it seems strange me to require a new build whenever Strapi CMS data changes for either content changes or creation/removal of entities that have their own dynamic page (ie: `/products/99).

Am I misunderstanding something?

hrvojej commented 2 years ago

As advised by NextJS creators:

We recommend using Static Generation over Server-side Rendering for performance reasons. Statically generated pages can be cached by CDN with no extra configuration to boost performance. However, in some cases, Server-side Rendering might be the only option. In combination with revalidation key that would probably be best option for rendering product pages which are basically changing less than blog pages for example - therefore Static Generation with some longer revalidation period (2-24 hours maybe.. depending on how often you actually change product pages) is desirable.