Skip to content

Conversation

jonathanturcotte
Copy link

The problem

When using disableNextScript and a nonce at the same time, React complains about a hydration mismatch between a nonce parameter with some value on the server, and a nonce value of "" in the client.

The cause

Nonces are removed by the browser from DOM elements to prevent them from being exposed to client side code. This happens before React hydrates the page, so it causes a mismatch.

The fix

Set suppressHydrationWarning on the vanilla script tag if nonce is being used.

@GruFFix
Copy link

GruFFix commented Sep 2, 2025

merge pls!!

@R1ON
Copy link

R1ON commented Sep 2, 2025

BUMP please

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.

3 participants