jamalsoueidanJ
Convex Communityβ€’14mo agoβ€’
10 replies
jamalsoueidan

How to preload data with Remix?

I understand in nextjs you can preload data with preloadQuery, but in remix it terminate the server, I also need to send the logged in user to convex, im using convex auth.
Error: Environment variable NEXT_PUBLIC_CONVEX_URL is not set.

I tried to add this env variable, but didnt work, in the past it did.

I also think adding the data to useQuery would be great...
  const {preloadedData} = useLoaderData<typeof loader>();
  const data= useQuery(api.resumes.get, {
    id: params.id as Id<"resumes">,
  }, {preloadedData} ); // << this would be great, this way data is not undefined

But how to fix this problem in remix? so i can remove the code below 😦

  if (!data) {
    return <>Loading data</>;
  }


Many thanks
Was this page helpful?