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

Expected server HTML to contain a matching <head> in <html> #184

Closed
OnlyC opened this issue Dec 19, 2022 · 17 comments
Closed

Expected server HTML to contain a matching <head> in <html> #184

OnlyC opened this issue Dec 19, 2022 · 17 comments

Comments

@OnlyC
Copy link

OnlyC commented Dec 19, 2022

Have you experienced this bug with the latest version of the template?

yes

Steps to Reproduce

  • npx create-remix@latest --template remix-run/indie-stack
  • npm run dev

Expected Behavior

No errors

Actual Behavior

image

@OnlyC
Copy link
Author

OnlyC commented Dec 21, 2022

Found the fix:
https://remix.run/docs/en/v1/pages/gotchas#browser-extensions-injecting-code

@OnlyC OnlyC closed this as completed Dec 21, 2022
@designbyadrian
Copy link

Found the fix: https://remix.run/docs/en/v1/pages/gotchas#browser-extensions-injecting-code

There is no fix mentioned in the link.

@pixeleate
Copy link

@designbyadrian the fix is to open the app in incognito mode, yes I know, I think the same this is not a fix, but it's what they suggested.

@danielbyun
Copy link

danielbyun commented Apr 25, 2023

Ran into issue today and found the plugin that was causing this issue.
Removed and is now working fine.

The fix is as @OnlyC 's url provided.

@bokaroto
Copy link

bokaroto commented Jun 1, 2023

hydration fails due to extensions that you have in your browser, it has nothing to do with the remix, it's a problem in React.
Because they inject extensions into pages , insert their own code, and then when rendering to the server and then to the client It's different and that's why it throws errors.
Ignore it or use the incognito tab.

@YuraGB
Copy link

YuraGB commented Oct 10, 2023

hydration fails due to extensions that you have in your browser, it has nothing to do with the remix, it's a problem in React. Because they inject extensions into pages , insert their own code, and then when rendering to the server and then to the client It's different and that's why it throws errors. Ignore it or use the incognito tab.

You are right

@mahmoudmoravej
Copy link

Mine was becuase of "Apollo Client Dev tools" extension. Disabling it solved as suggessted.

@Guteres007
Copy link

Mine was becuase of "Apollo Client Dev tools" extension. Disabling it solved as suggessted.

Yes, work for me in V2

@deadcoder0904
Copy link

@designbyadrian the fix is to open the app in incognito mode, yes I know, I think the same this is not a fix, but it's what they suggested.

solved it for me :)

@designbyadrian
Copy link

@designbyadrian the fix is to open the app in incognito mode, yes I know, I think the same this is not a fix, but it's what they suggested.

solved it for me :)

It won't solve it for every visitor to your website.

@deadcoder0904
Copy link

It won't solve it for every visitor to your website.

well, only developers like to open the console.

and there are many high-profile production websites that have consoles filled with red-wedding :)

@Disorrder
Copy link

Fixed by restricting allowed sites list for my specific extension not related to react

@deadcoder0904
Copy link

@Disorrder how did you do that? i tried googling for hacks like that but nothing worked lol.

@fzn0x
Copy link

fzn0x commented Apr 10, 2024

@deadcoder0904 I think modify the manifest.json

or use this code for manifest 2

chrome.browserAction.onClicked.addListener(function(tab) {
    if(!tab.url || !tab.url.startsWith('http')){
        return;
    }

    // do stuff
});

@designbyadrian
Copy link

designbyadrian commented Jun 7, 2024

It won't solve it for every visitor to your website.

well, only developers like to open the console.

and there are many high-profile production websites that have consoles filled with red-wedding :)

The problem is that this error can cause blocked renders, leading to empty pages or missing styles. It's not simply the issue of text inside the console. You can't force users to disable extensions or view in incognito mode.

The real solution is to use a certain version of React that has a fix. Apparently, version 19 rc has it. Previously, it was the canary version of 18.3.0: 18.3.0-canary-a870b2d54-20240314

Set the exact version and overrides in package.json

"dependencies": {
    "react": "18.3.0-canary-a870b2d54-20240314",
    "react-dom": "18.3.0-canary-a870b2d54-20240314",
  ...
},
"overrides": {
    "react": "18.3.0-canary-a870b2d54-20240314",
    "react-dom": "18.3.0-canary-a870b2d54-20240314"
  },
}

@ivo-kalendar
Copy link

It won't solve it for every visitor to your website.

well, only developers like to open the console.
and there are many high-profile production websites that have consoles filled with red-wedding :)

The problem is that this error can cause blocked renders, leading to empty pages or missing styles. It's not simply the issue of text inside the console. You can't force users to disable extensions or view in incognito mode.

The real solution is to use a certain version of React that has a fix. Apparently, version 19 rc has it. Previously, it was the canary version of 18.3.0: 18.3.0-canary-a870b2d54-20240314

Set the exact version and overrides in package.json

"dependencies": {
    "react": "18.3.0-canary-a870b2d54-20240314",
    "react-dom": "18.3.0-canary-a870b2d54-20240314",
  ...
},
"overrides": {
    "react": "18.3.0-canary-a870b2d54-20240314",
    "react-dom": "18.3.0-canary-a870b2d54-20240314"
  },
}

@designbyadrian this works fine. I don't see the usual error and the production console is clean, but now i have another error only in development:
Warning: Prop dangerouslySetInnerHTML did not match. Server: "" Client: "\n/* /app/tailwind.css */\n/*\n! tailwindcss v3.4.4 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width.....
I'm using the latest:
npx create-remix@latest --template remix-run/remix/templates/express

@ARBS23
Copy link

ARBS23 commented Jun 20, 2024

Removing Dark Mode v0.5.1 Chrome extension solved the issue

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

No branches or pull requests