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

Add a "missing suspense boundary" warning/error #1046

Closed
joshribakoff-sm opened this issue Apr 12, 2022 · 2 comments
Closed

Add a "missing suspense boundary" warning/error #1046

joshribakoff-sm opened this issue Apr 12, 2022 · 2 comments

Comments

@joshribakoff-sm
Copy link

function Suspender() {
  throw new Promise(() => null);
  return null;
}

render(<Suspender />)
screen.debug()

This logs:

  console.log
    <body>
      <div />
    </body>
    

It's missing the error:

A React component suspended while rendering, but no fallback UI was specified

In a "real" (non test) environment, you get this warning. Ideally test semantics match the real semantics.

@eps1lon
Copy link
Member

eps1lon commented Apr 12, 2022

This behavior changed in React 18. There is no longer a warning when there's no Suspense boundary: https://codesandbox.io/s/missing-suspense-is-fine-ir1jl4

I'll double-check if that's intended by React and just forgotten in the changelog. But it's nothing we can do on our side.

@eps1lon eps1lon closed this as completed Apr 12, 2022
@eps1lon
Copy link
Member

eps1lon commented Apr 12, 2022

Intentionally changed in facebook/react#23267

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

2 participants