mui / mui/material-ui

[material-ui][Box] Box throws an error when there is a RSC (React Server Component) as a child

Open
#39,928 9 comments 5 reactions 1 assignee View on GitHub

@siriwatknp is already working on this.

Since Nov 20, 2023.

component: Box external dependency nextjs scope: system
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Steps to reproduce 🕹

Link to live example: https://codesandbox.io/p/devbox/fragrant-forest-gn5rr6?file=%2Fsrc%2Fapp%2Fpage.tsx%3A1%2C1

import { Box } from '@mui/material'

async function FooBar() {
  return <Box>foobar</Box>
}

export default function Page() {
  return (
    <Box>
      <FooBar />
    </Box>
  )
}
Current behavior 😯

Throws the following error:

app-index.js:32 Warning: Failed prop type: Invalid prop children supplied to ForwardRef(Box), expected a ReactNode.

Expected behavior 🤔

Not error =D

Context 🔦

Absolutely love MUI, but this is preventing us from using it in server components

Your environment 🌎

System:
OS: macOS 13.6
Binaries:
Node: 18.17.0 - ~/.nodenv/versions/18.17.0/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.6.7 - ~/.nodenv/versions/18.17.0/bin/npm
Browsers:
Chrome: 119.0.6045.159
Edge: Not Found
Safari: 16.6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.