Skip to content
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

Hydration error fix for articles #39

Merged
merged 5 commits into from
May 21, 2022
Merged

Conversation

rutkuli
Copy link
Contributor

@rutkuli rutkuli commented May 18, 2022

Articles as well as Slug page has a problem with hydration which isn't really a major issue. But I fixed it at least in one way that allows the pages re-render without any issues.

Added, UseState for article formatDate function so that the times between client and server are correct.
Added, UseState for article formatDate function so that the times between client and server are correct.
Added, UseState for article formatDate function so that the times between client and server are correct.
Copy link
Owner

@HamishMW HamishMW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right because it formats the date by locale it'll cause hydration issues if the locale is different to where the static site was generated. Thanks for picking up on this, just a couple suggestions from me:

src/layouts/Post/Post.js Outdated Show resolved Hide resolved
src/pages/articles/Articles.js Outdated Show resolved Hide resolved
@rutkuli
Copy link
Contributor Author

rutkuli commented May 20, 2022

ah yes, you are absolutely right as Ignoring this rule is very bad. in the worst case, it could open up some weird "bugs".

rutkuli and others added 2 commits May 21, 2022 02:57
@HamishMW HamishMW merged commit 26c1949 into HamishMW:master May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants