CrymeLordC
Convex Community13mo ago
54 replies
CrymeLord

Type error when using useSuspenseQuery with convexQuery

In a vanilla Tanstack Start / Convex app, I have a query:

export const getUserById = query({
  args: {
    id: v.id("users"),
  },
  handler: async (ctx, args) => {
    return await ctx.db.get(args.id);
  },
});


And when I try to use that like this:

function Home() {
  const { data } = useSuspenseQuery(
    convexQuery(api.users.getUserById, {
      id: "some_id_here",
    }),
  );

  console.log(data);

  return <div>test</div>;
}


I get this type error: Type 'typeof skipToken' is not assignable to type 'QueryFunction<any, ["convexQuery", FunctionReference<"query", "public", { id: Id<"users">; }, any, string | undefined>, { id: Id<"users">; }], never>'.

Not sure what's going on there 🤷
Was this page helpful?