CodingWithJamal
CodingWithJamal16mo ago

Qwik

Im working on porting my project into https://qwik.builder.io + convex, i will see how it goes
2 Replies
ian
ian16mo ago
It seems similar to some work we've explored in handing off query subscriptions between server-side rendering and client hydration. I'm curious how you go about subscribing to changes - or are you starting with just static fetches in a routeLoader ? I haven't thought much about it before--others like Tom probably already have given it some more thought-- but musing about useResource$ paired with a useStore and the non-React ConvexClient? Fetch it first server-side with a one-time fetch, then register it again client-side: two fetches but probably fine for now? Eventually do a more custom serialization of a context? Just thinking out loud here - looking forward to hearing how it goes
CodingWithJamal
CodingWithJamalOP16mo ago
So ive just started this and im working with qwik for the first time. Last night i implemented authentication w/ convex + auth.js in quick using the layout middlewares and api routes. I can then use the auth.js package to get the session and sync with the client side. Next I will on subscriptions now using the convexHttp client which seems to work best for this since of thing on the server side since qwik components are both a mix of server and client thanks to streaming the js but its going well so far However only project i have is converting types without using any. In convex we have the table types as `Id<"tableName". However I normally just cast it to a string because it kinda is... but its not really safe.
const newUser = await convexClient.mutation(api.user.update, {
id: user.id as any,
email: user.email as string,
emailVerified: user.emailVerified ? user.emailVerified.toISOString() : undefined,
image: user.image ?? undefined,
})
const newUser = await convexClient.mutation(api.user.update, {
id: user.id as any,
email: user.email as string,
emailVerified: user.emailVerified ? user.emailVerified.toISOString() : undefined,
image: user.image ?? undefined,
})
Type 'string' is not assignable to type 'Id<"user">'.

Did you find this page helpful?