#Getting error when using convexQuery with useSuspenseQuery
13 messages · Page 1 of 1 (latest)
Thanks for posting in #1088161997662724167.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's #1228095053885476985 channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
@woeful gazelle I just released @convex-dev/[email protected] to fix this
Okay this works
Thanks
When using useSuspenseQueries now I'm getting error relating to staleTime
Can you show the error?
Is it when you use staleTime or something else? @woeful gazelle
When I spread the ...convexQuery() it complains about a type mismatch with stale time
Let me get on my laptop and show the error
ah hm, I'll add a test for this in https://github.com/get-convex/convex-react-query/blob/main/src/index.test.ts
Type '{ queryKey: ["convexQuery", FunctionReference<"query", "public", {}, { currentMonthTotalSales: number; lastMonthTotalSales: number; percentageIncrease: number; }, string | undefined>, {}]; queryFn: QueryFunction<...> | undefined; staleTime?: StaleTime<...> | undefined; }' is not assignable to type 'UseSuspenseQueryOptions<{ currentMonthTotalSales: number; lastMonthTotalSales: number; percentageIncrease: number; }, unknown, unknown, ["convexQuery", FunctionReference<"query", "public", {}, { currentMonthTotalSales: number; lastMonthTotalSales: number; percentageIncrease: number; }, string | undefined>, {}]>'. Types of property 'staleTime' are incompatible.
If I pass a staleTime of staleTime: Number.POSITIVE_INFINITY the type error is gone
The code ts const [ { data: sales }, { data: orders }, { data: activeArtworks }, { data: revenue }, ] = useSuspenseQueries({ queries: [ { ...convexQuery(api.overview.getArtistMonthlySales, {}), }, { ...convexQuery(api.overview.getArtistMonthlyOrders, {}), // staleTime: Number.POSITIVE_INFINITY, }, { ...convexQuery(api.overview.getArtistActiveArtworks, {}), // staleTime: Number.POSITIVE_INFINITY, }, { ...convexQuery(api.overview.getArtistMonthsRevenue, {}), // staleTime: Number.POSITIVE_INFINITY, }, ], });
If i uncomment the staleTime the type mismatch is gone