question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow disabling pre-rendering, even in absence of getServerSideProps

See original GitHub issue

Feature request

Add a configuration option to globally disable pre-rendering.

Is your feature request related to a problem? Please describe.

Pre-rendering takes memory, build cycles, and requires that in our that we handle cases where getInitialProps is not called by next.js. We are fully dependent on getInitialProps to be called on our pages during SSR, and thus must detect and noop when next is pre-rendering on load or on build. It adds complexity and cost to our dev/build cycles for a feature we do not use.

We use SSR, but strictly via getInitialProps. This is to avoid the high cost penalty of hitting the server on every client-side navigation. By using getInitialProps, we offload all work to our user’s browsers & CDNs post-browser-application-hydration, and not burden our otherwise busy servers. We understand why getServerSideProps is a great API, but have opted not to use it for our performance-concerned architecture.

https://nextjs.org/docs/basic-features/pages#pre-rendering implicitly states that “you can use SSR” as an alt method to pre-rendering. However, I am using SSR, just not via the getServerSideProps API.

Describe the solution you’d like

Describe alternatives you’ve considered

  • using getServerSideProps, but deemed it to not be an option

Additional context

n/a

Thanks for your time and consideration.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
caubcommented, Dec 7, 2020

It doesn’t seem to work, as shown in this small example: https://repl.it/@caub/nextjs-server-side#pages/index.js

If there was to pre-rendering, there wouldn’t be the console warning: “Warning: Did not expect server HTML to contain the text node “Hello” in <div>”

Also it should render “Test: Hello”

0reactions
balazsorban44commented, Jan 29, 2022

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable Nextjs from pre-rendering a page?
You can disable SSR for a specific component while exporting it. const NoSSRYourComponent = () => { return ( // .
Read more >
Advanced Features: Automatic Static Optimization | Next.js
Automatic Static Optimization. Next.js automatically determines that a page is static (can be prerendered) if it has no blocking data requirements.
Read more >
Next.js: The Good, Bad and Ugly - An Idiosyncratic Blog
Next. js automatically determines that a page is static (can be prerendered) if it has no blocking data requirements. This determination is ...
Read more >
Next.js site pages all 404; new way to deploy Next.js? - Support
The Next.js Runtime allows Next.js to run on Netlify with zero ... However, any new deploy previews are still showing a 404 for...
Read more >
Can someone explain me the hype about SSR? : r/reactjs
A lot of folks default to NextJs even if you don't need SSR. ... user clicks generate routes, admins can enable/disable features and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found