Skip to content

Server Side Rendering Behaviour #881

Answered by laymonage
LukeTwomey asked this question in Q&A
Discussion options

You must be logged in to vote

When you navigate from one blog page to another, either React or Next.js is being smart by only re-rendering the ReactMarkdown and BlogPreview components in your blog page component because their props have changed. The other components, including the giscus component, are not re-rendered because their props stay the same, even when you navigate to a different blog page.

If you navigate to the homepage, that's a different page component and the giscus component does not exist there, so it gets unmounted by React. When you load another blog page, the giscus component is freshly mounted again, so there's no issue.

A possible solution is to pass the id that you have in getStaticProps as the key

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@LukeTwomey
Comment options

Answer selected by LukeTwomey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants