-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[Docs]: Did not expect server HTML to contain a <script> in <html> #1077
Comments
Hi @chanan, You can also add export default function App() {
return (
- <html lang='en'>
+ <html lang='en' suppressHydrationWarning={true}>
<head>
... |
I'd strongly recommend against suppressing all warnings like this. It could silence actual problems. If it were me, I would disable this extension until this issue has been resolved on the extension author's side. |
Hey all, removed react-dev-tools but I still get the warning 😢 and I don't want to supress them all as suggested by @kentcdodds |
@joanofdart, I don't think react devtools causes this warning. Are you sure it's not another extension that's causing it? It could also be a third party library that's modifying the DOM before React hydrates the app. |
@kentcdodds ill disable them all and check which one is causing this 😄 thanks for the quick response tho! |
In my case it was Apollo Client Devtools v4.0.0. Disabling it made the error message disappear, enabling it made it re-appear. |
For me it was "Google Analytics Opt-out Add-on (by Google)" - https://chrome.google.com/webstore/detail/google-analytics-opt-out/fllaojicojecljbmefodhfapmkghcbnh?hl=en |
For me, it's ThreeJS Developer Tools extension for Chrome https://chrome.google.com/webstore/detail/threejs-developer-tools/ebpnegggocnnhleeicgljbedjkganaek |
In my case, it's the video.js library and I need it |
I also receive this warning if I try to add a third-party script in the Remix app using <script> tag in the body. Is there a better way to go about this, loading third-party scripts? Maybe I missed it in the docs. |
🤖 Hello there, We just published version Thanks! |
I'm getting this as well, on remix 1.4.1. |
Hi, why is this issue closed? I understand that the issue is probably not on Remix yet it's expected to have extensions injecting scripts in apps, I am not sure why we get this warning. Could it be at least more explicit (for instance having a bit more info about the script to quickly tell which one is responsibile)? |
The warning you see is coming from React, not Remix. So there's literally nothing Remix can do for you here. You'll want to open an issue on React if you want to improve the error message. |
Hello ! |
Disabling the Apollo Client Devtools extension fixed the issue for me. 👍 |
SAME |
This plugin was also the cause of the issue for me. |
Just reporting seeing this issue with Adobe Acrobat: PDF edit, convert, sign tools Chrome extension |
For me it was a coupon extension. Never would have thought about it. |
I have the same problem with newrelic.getBrowserTimingHeader, Newrelic browser agent |
I am experiencing an issue where the __staticRouterHydrationData is not present in the final server-rendered version of my application, despite being generated during the server-side rendering process.
This script tag, specifically for __staticRouterHydrationData, is available when generated on the server. However, it mysteriously disappears in the final version. Has anyone else encountered a similar problem, or perhaps could provide insight on why this might be happening? |
Hi @Elijah-trillionz did you manage to run videojs on remix without getting those errors? |
@gavriguy when trying to import a package that doesn't support SSR, the typical solution is to re-export the component from a // components/video.js.client.tsx
import videojs 'video.js'
export const VideoJS = (props) => {
// from https://videojs.com/guides/react/
// ...
}
export default VideoJS // routes/video.tsx
import VideoJS from '~/components/video.js.client'
import { ClientOnly } from 'remix-utils'
export default Component() {
return (
<ClientOnly>
{() => <VideoJS />
</ClientOnly>
)
} |
Hi @kiliman thanks for your answer. That's exactly what I did but I still get errors: |
@gavriguy Hmm.. Here's a working ⚡️stackblitz https://stackblitz.com/edit/remix-run-remix-c7dobq?file=app%2Froutes%2F_index.tsx |
Hydration issues occur when code outside of your app modifies the DOM. This is typically caused by browser extensions. There are workarounds like https://github.com/kiliman/remix-hydration-fix. The next version of React will minimize these hydration errors. You can verify by installing |
Thanks for you help much appreciated. I gave your solution a try and it works without any errors. Cheers :) |
It seems that I have resolved my issue by using suppressHydrationWarning, but I'm unsure whether this is a good solution or simply a workaround. Is this behavior expected and should it work correctly in React version 17?
|
Hey, I have a html template that I have to move to Remix.js witch includes many js files, from libraries like bootstrap to custom js, but when I put them into the public folder and try to include them into the root.tsx file I see in the server console errors regarding route not found plus on the client hydration issues and also the ui for a second has a flicker but the js is not working... Is this something that is not supported or I don't know? |
What version of Remix are you using?
1.0.6
What version of Node are you using? Minimum supported version is 14.
16
Steps to Reproduce
npx create-remix@latest
yarn
to install packagesyarn dev
to start the serverExpected Behavior
No errors should be shown in the console
Actual Behavior
The following error is shown in the browser dev console:
The text was updated successfully, but these errors were encountered: