Browser forward navigation button throws a "use client" error.
Answered
Exotic Shorthair posted this in #help-forum
Exotic ShorthairOP
The problem is specifically in the "src\app(site)\products[product_Id]\page.tsx" route.
here is the link to the repo: https://github.com/AkeaNine/NeonAge-Next.js
also here is the error:
Unhandled Runtime Error
Error: async/await is not yet supported in Client Components, only Server Components. This error is often caused by accidentally adding
here is the link to the repo: https://github.com/AkeaNine/NeonAge-Next.js
also here is the error:
Unhandled Runtime 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.58 Replies
Exotic ShorthairOP
@DirtyCajunRice | AppDir
what did i do
Exotic ShorthairOP
lol
oh righ right
so. couple things
1. dont do React.FC<PageProps>
instead do
const page = async ({ params, searchParams }: PageProps) => {2. always uppercase your component first letter
so Page not page
Exotic ShorthairOP
noted
outside of that, i am not seeing anything crazy
oo
bump your typescript version
wait thats fine i thought that was your types/node
ah fuck it lemme just pull it
Exotic ShorthairOP
the MainProductSection.tsx file inside the [product_id]/component has a use client
man it's all confusing. this is my first next.js app
Exotic ShorthairOP
wait
xk3ins0n
use this inside the projectID
so this is deep in there
so localhost:3000/products/(whatamiputtinghere)
im not getting any async errors
Exotic ShorthairOP
then click the forward navigation button
Exotic ShorthairOP
you got it
add a loading.tsx file
Answer
you dont have an error boundary for your async route segment
the error you are getting is really bad for the actual problem
its just that you need to have that loading.tsx
const Loading = () => {
return "Loading..."
}
export default Loading;Exotic ShorthairOP
that worked!!!
@DirtyCajunRice | AppDir you dont have an error boundary for your async route segment
Exotic ShorthairOP
wait what is the async route segment here?
@Exotic Shorthair wait what is the async route segment here?
your page is a route segment
all pages / layouts are route segments
so its just a general term
when you make a page async (which is totally fine and good) you should always have a loading.tsx paired with it to handle any oopsies or slow network etc
ideally always an error.tsx too but thats a different convo haha
Exotic ShorthairOP
i see
okay thanks a lot man
no problem!