noob saibotN
Convex Communityβ€’2y agoβ€’
4 replies
noob saibot

Error: Unexpected type of undefined

In my nextjs app, I'm using preloadQuery to load and render a query inside a Server Component:
  ... 
  // this is a server component
  const localesQuery = preloadQuery(api.locales.get.default, {
    locale: "en",
  });

  return <RenderLocales query={localesQuery} />

Then in my client component, I past the result into a usePreloadedQuery.
"use client";
...

export const RenderLocales = ({ query }) => {
  const locales = usePreloadedQuery(query); // <-- if I remove this line, component renders fine
  return <div>...</div>
}

I'm observing that every time the hook is called, an error is thrown on the next line. If I remove the hook then the app runs fine.
Below is a screenshot of the error reported at the very next line where the rendering starts.
Is this perhaps a well-known bug?

"convex": "^1.13.2",
"next": "^14.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
image.png
Was this page helpful?