SummaryWhat's the most common approach when it comes to bulding ecommerce websites with NextJS? Let's say you have 1000 products: do you use getStaticPaths+getStaticProps or do you use getServerSideProps? (I give more info below as to how frequently the data is updated) On one hand if you use getStaticProps and have lots of products, it will take a lot of time & compute power to rebuild the pages - But that doesn't happen if you use on-demand revalidation, right? As far as I understand, you have the ability to revalidate only the page data of the products that you've changed, so rebuilding the pages of all the products wouldn't be necessary, am I wrong here? On the other hand: the common answer is "if they get updated frequently, use getServerSideProps" but in my case the only thing that maybe would be updated frequently in the product page is the stock/available sizes, so is worth it to use getServerSideProps (which has a higher strain on the server compared to getStaticProps) only because of one value? Would it be better to use getStaticProps and fetch-render the available sizes client-side? The downside to this is that when google crawlers visit your website, they'll see a "loading available sizes" message or a loading spinner only for that specific small part of the product page for a second. But that's not a huge SEO penalty, right? And could you make it "less harmful" using React Query features? Additional informationNo response ExampleNo response |
Replies: 1 comment
|
Just gonna throw in a few points that work altogether:
|
Just gonna throw in a few points that work altogether:
fallback: true, and that'll force you to implement the Fallback page by checkinguseRouter().isFallbackfor the pages that are not generated at build time