devagr
devagr3mo ago

convexQuery doesn't work with useSuspenseQuery

const q = convexQuery(api.domains.product.getAllProducts, {});
console.log(q);
const { data: products } = useSuspenseQuery(q);
const q = convexQuery(api.domains.product.getAllProducts, {});
console.log(q);
const { data: products } = useSuspenseQuery(q);
Logs
[["convexQuery","domains/product:getAllProducts",{}]]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function
[["convexQuery","domains/product:getAllProducts",{}]]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function
No description
5 Replies
devagr
devagrOP3mo ago
this works with the non suspense useQuery from tanstack, even without the query function but throws an error with useSuspenseQuery
dan myles
dan myles3mo ago
i think in general there’s a lot of rough edges with the tanstack integration, my hope is that the API of the normal use query will just be improved
mikeysee
mikeysee3mo ago
hmm @ballingt I think has done the most with Tanstack, he might be able to help
ballingt
ballingt3mo ago
@devagr hey did you see there are some extra setup steps? @devagr see https://github.com/get-convex/convex-react-query?tab=readme-ov-file#setup oh nevermind, if normal useQuery works then should be ok @devagr are you using useSuspenseQuery with TanStack Start or somewhere else? in this demo app https://convex-tanstack-start.vercel.app/ (from quite a while ago) it worked https://github.com/get-convex/convex-tanstack-start/blob/main/app/routes/react-query.tsx#L22-L25 oh yeah maybe you missed a setup step, there is supposed to be a default query function set
devagr
devagrOP3mo ago
yep i was missing that setup step thank you very much @ballingt the lack of suspense was bugging me so much

Did you find this page helpful?