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

ハイドレーション時にテキストがサーバーとクライアントで異なるとエラーが発生する #290

Open
1 task
takecchi opened this issue Feb 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@takecchi
Copy link
Member

関連Issue

(無ければ空)

概要

サーバーサイドとクライアントサイドでレンダー結果が異なる場合に発生するエラー。
https://develop.cuculus.jp/takecchi/posts/71611659296186368

エラーの内容

Unhandled Runtime Error
Error: Text content does not match server-rendered HTML.

Warning: Text content did not match. Server: "24秒前" Client: "25秒前"

See more info here: https://nextjs.org/docs/messages/react-hydration-error

参照: https://nextjs.org/docs/messages/react-hydration-error

今回はPostの時刻表示の部分で発生しており、ドキュメントにもあるように必然的に異なるケースに該当する為、以下の対応でよさそう

suppressHydrationWarning={true}

Todo

  • やることリスト
@takecchi takecchi added the bug Something isn't working label Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant