Skip to content

[material-ui] Compatibility issues with Remix #44993

@davidbielik

Description

@davidbielik

Steps to reproduce

Steps:

  1. Install remix defaults npx create-remix@latest remix-mui-bug
  2. Install mui defaults npm install @mui/material @emotion/react @emotion/styled
  3. Import and add any MUI component, like a <Button>

Current behavior

Hydration errors (and also for some reason the button converts from variant="contained" to variant="text" upon hydration?)

 Warning: Prop `charSet` did not match. Server: "null" Client: "utf-8" Error Component Stack
    at meta (<anonymous>)
    at head (<anonymous>)
    at html (<anonymous>)
    at Layout (root.tsx:25:26)


Uncaught Error: Hydration failed because the initial UI does not match what was rendered on the server.
    at throwOnHydrationMismatch (react-dom.development.js:12507:9)
    at tryToClaimNextHydratableInstance (react-dom.development.js:12535:7)
    at updateHostComponent (react-dom.development.js:19931:5)
    at beginWork (react-dom.development.js:21657:14)
    at HTMLUnknownElement.callCallback2 (react-dom.development.js:4164:14)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:16)
    at invokeGuardedCallback (react-dom.development.js:4277:31)
    at beginWork$1 (react-dom.development.js:27490:7)
    at performUnitOfWork (react-dom.development.js:26596:12)
    at workLoopConcurrent (react-dom.development.js:26582:5)
image

Expected behavior

I should be able to npm install mui and not have hydration errors

Context

I followed the advice here: #39765 by adding this provider but still seeing the error

Your environment

npx @mui/envinfo
  System:
    OS: macOS 14.4.1
  Binaries:
    Node: 20.11.1 - ~/.asdf/installs/nodejs/20.11.1/bin/node
    npm: 10.2.4 - ~/.asdf/plugins/nodejs/shims/npm
    pnpm: 8.15.5 - ~/.asdf/installs/nodejs/20.11.1/bin/pnpm
  Browsers:
    Chrome: 131.0.6778.265
    Edge: Not Found
    Safari: 17.4.1
  npmPackages:
    @emotion/react: ^11.14.0 => 11.14.0 
    @emotion/styled: ^11.14.0 => 11.14.0 
    @mui/core-downloads-tracker:  6.3.1 
    @mui/material: ^6.3.1 => 6.3.1 
    @mui/private-theming:  6.3.1 
    @mui/styled-engine:  6.3.1 
    @mui/system:  6.3.1 
    @mui/types:  7.2.21 
    @mui/utils:  6.3.1 
    @types/react: ^18.2.20 => 18.3.18 
    react: ^18.2.0 => 18.3.1 
    react-dom: ^18.2.0 => 18.3.1 
    typescript: ^5.1.6 => 5.7.3

Search keywords: remix Warning: Prop charSet did not match. Server: "null" Client: "utf-8" Error Component Stack

Metadata

Metadata

Assignees

Labels

scope: all componentsWidespread work has an impact on almost all components.type: bugIt doesn't behave as expected.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions