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

proptypes warning when passing an async server component as children #40935

Closed
Janpot opened this issue Feb 4, 2024 · 4 comments
Closed

proptypes warning when passing an async server component as children #40935

Janpot opened this issue Feb 4, 2024 · 4 comments
Assignees
Labels
duplicate This issue or pull request already exists external dependency Blocked by external dependency, we can’t do anything about it nextjs

Comments

@Janpot
Copy link
Member

Janpot commented Feb 4, 2024

Steps to reproduce

Link to live example: https://stackblitz.com/edit/github-n2hgfw?file=src%2Fapp%2Fpage.tsx

Steps:

  1. Open example
  2. Check the browser console

Current behavior

Error:

Warning: Failed prop type: Invalid prop `children` supplied to `ForwardRef(Box)`, expected a ReactNode.

The warning doesn't happen when you add a div in between

import { Box } from '@mui/material';

export async function ServerComponent() {
  return <h1>Test</h1>;
}

export default function Home() {
  return (
    <Box>
      <div>
        <ServerComponent />
      </div>
    </Box>
  );
}

Expected behavior

No proptypes error

Context

Related: #35676

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: proptypes server components

@Janpot Janpot added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 4, 2024
@oliviertassinari
Copy link
Member

A bug with https://github.com/facebook/prop-types?

children: PropTypes.node,

@oliviertassinari oliviertassinari changed the title proptypes warning when passing a server component as children proptypes warning when passing an async server component as children Feb 4, 2024
@Janpot
Copy link
Member Author

Janpot commented Feb 4, 2024

Yep, I'm opening a ticket with them as well

@siriwatknp siriwatknp added external dependency Blocked by external dependency, we can’t do anything about it and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 13, 2024
@siriwatknp
Copy link
Member

I guess we will just need to wait for the fix from React side or Next.js?

@siriwatknp siriwatknp added the duplicate This issue or pull request already exists label Feb 13, 2024
@siriwatknp
Copy link
Member

duplicate of #39928

@siriwatknp siriwatknp closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists external dependency Blocked by external dependency, we can’t do anything about it nextjs
Projects
None yet
Development

No branches or pull requests

4 participants