question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[next@12.1.1-canary.17 + react@18.0.0-rc.3] The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering

See original GitHub issue

Verify canary release

  • I verified that the issue exists in Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 21.4.0: Mon Feb 21 20:34:37 PST 2022; root:xnu-8020.101.4~2/RELEASE_X86_64
Binaries:
  Node: 16.13.1
  npm: 8.1.2
  Yarn: 1.22.18
  pnpm: N/A
Relevant packages:
  next: 12.1.1-canary.17
  react: 18.0.0-rc.3
  react-dom: 18.0.0-rc.3

What browser are you using? (if relevant)

Chrome

How are you deploying your application? (if relevant)

next dev

Describe the Bug

The next@12.1.1-canary.17 and react@18.0.0-rc.3 does not work with Suspense mode.

import {lazy, Suspense} from 'react';

const MyComponent = lazy(() => import('../components/MyComponent'));
...
  <Suspense fallback='Loading...'>
      <MyComponent />
   </Suspense>
...

image

Expected Behavior

Just works

To Reproduce

0/ Clone https://github.com/nghiepit/next-12-react-18-rc 1/ yarn install 2/ yarn dev 3/ See error…

Note: The error appears only once, to show the error again we need to restart the server with yarn dev

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:21 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
harisraharjocommented, Apr 2, 2022

Can confirm that this is still an issue on next 12.1.4. In my case I can’t load Canvas from react-three-fiber (which is a big component) using next/dynamic with {ssr: false, suspense: true}. But if I tried to load small components, it works. Edit: It works with React.lazy but not with next/dynamic {ssr: false, suspense: true}

1reaction
flybayercommented, Nov 8, 2022

to be clear, this is still an issue with nextjs because nextjs has no way to render a suspense fallback on the server without an error message showing.

Functionally everything works expect for this incorrect error.

In blitz we patch the nextjs reactdom error function to hide this error. We’ll update that for nextjs this week, but functionality still works correctly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I'm glad I'm not the only one that thinks this error sucks. : r/nextjs
"Error: This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering.
Read more >
Advanced Remix Suspense Boundary Error - Frontend Masters
Kent briefly debugs a boundary error thrown by the Suspense component. ... it finished hydrating. This caused a boundary just switch to client...
Read more >
Handling runtime errors when server side rendering with Next.js
Let's take a look of ways how can we avoid a webpage from crashing in production? 1. Error boundary. function Tile(props) { return ......
Read more >
Testing and error handling patterns in Next.js - LogRocket Blog
These can be used within the API of a JavaScript framework or library to handle errors, such as with Next.js APIs, getStaticProps , ......
Read more >
reactfire - npm
Create a document in Cloud Firestore. Go to the Database tab in the Firebase console. If your project doesn't have a Cloud Firestore...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found