Skip to content

Latest commit

 

History

History
38 lines (23 loc) · 1.48 KB

0011-suppressing-hydration-warnings-on-scripts.md

File metadata and controls

38 lines (23 loc) · 1.48 KB

11. Suppressing Hydration Warnings on Scripts

Date: 2023-03-10

Status

Accepted

Context

Hydration Warning

When using the app in development mode, the console is filled with hydration warnings. This usually is because the server and client render different content.

In this case however the error stems from a change in the DOM specification which aims to reduce attack vectors by removing the nonce attribute from elements.

This inadvertently causes differences between the server and the client side and React freaks out.

There is an outstanding issue to look into the problem.

We had a solution for this that was taken from a stackoverflow post.

This solution worked, but it seemed to be introducing a lot of "magic" to mask the problem.

Decision

After some discussion, we decided to do the same thing Remix does and suppress the warnings at the script level without any additional magic.

Consequences

  • We will no longer see hydration warnings in development mode.
  • We have to keep an eye on the React issue to see if they come up with a better solution.