-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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
server-side caching? #925
Comments
There is already an example of server side rendering with cache in the repo: |
@sergiodxa okay cool - so does that avoid client-side rendering completely for pages that are inside the cache? as the risk I wish to avoid is having the dependencies of server-side rendered pages get included in client-side bundles, when they are not needed as the content is rendered server-side |
No, what that it's going to do is that if the user access a page for the first time (or reload a page) the first time that page it's rendered in the server as usual, but after the first server render it's going to return the cache. If the user transition to that page in the client, then it's always going to render in the client. If you want to avoid that at all I think you can use a normal anchor tag to change pages to the only-server rendered page instead of using the Next.js Link component |
Thanks @sergiodxa for answering the question. |
I'm considering using next.js for an application where we want to render markdown files.
However, rendering a markdown file + syntax highlighting + all the rest for each client request is quite intensive on the server, and on the client more so as each client has to load the markdown and syntax highlighting libraries to perform the operation.
Is there a way with next.js for the server to cache a request's render result somewhere, such that a future request can just serve the rendered HTML. This would move rendering of markdown and syntax highlighting to the server, but that seems like a good idea to me.
Or is such an approach antithetical to the react + next.js way?
The text was updated successfully, but these errors were encountered: