Next.js Discord

Discord Forum

Inconsistent errors with rendering async components under Client Components

Unanswered
Pembroke Welsh Corgi posted this in #help-forum
Open in Discord
Pembroke Welsh CorgiOP
Hello! I'm putting together a lunch and learn demo for my team about the client - server boundary and the composition patterns section of the docs. I want to demonstrate what happens when we hoist the "use client" directive so far up the component tree and then want to use a RSC that fetches data before rendering. Sometimes I'll get the error:

Error: async/await is not yet supported in Client Components, only Server Components. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server.


Often times I won't, and I'll see the data is actually fetched from the client.

I'm curious as to why this error is so inconsistent, and if there is a better way to demonstrate why pushing client components to the component tree edges?

Thanks!

Link to my simple demo: https://github.com/JTP709/next-client-server-boundary-demo

0 Replies