HydrationBoundary causing Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server".
#7172
Answered
by
TkDodo
Rodrigo-JM
asked this question in
Q&A
Replies: 1 comment 4 replies
-
try |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've followed the example for integrating TanStack/query into NEXTJS 14.
But when i try to use
const dehydratedState = dehydrate(queryClient);
with
<HydrationBoundary state={dehydratedState}>
I get the error
Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". [function] ^^^^^^^^ at stringify (<anonymous>) digest: "771832800"
this is the query i am trying to prefetch
await queryClient.prefetchQuery({ queryKey: ["top-bar"], queryFn: getTopBar, });
if i change getTopBar to another function that doesn't fetch any data, it works. but when i return the getTopBar function to its normal code, it doesn't work. And I am marking the file with "use server" anyway
Beta Was this translation helpful? Give feedback.
All reactions