CrymeLord
CrymeLord
CCConvex Community
Created by CrymeLord on 1/3/2025 in #support-community
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);
},
});
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>;
}
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 🤷
55 replies