[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 issueVerify 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>
...
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:
- Created a year ago
- Comments:21 (16 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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}
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.