#Getting error when using convexQuery with useSuspenseQuery

13 messages · Page 1 of 1 (latest)

woeful gazelle
#
const { data } = useSuspenseQuery({
  ...convexQuery(api.overview.getArtistMonthlySales, {}),
});```

Seems like convexQuery is passing skipToken which isn't supported in useSuspenseQuery
fallow crestBOT
#

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!

forest lava
woeful gazelle
woeful gazelle
#

When using useSuspenseQueries now I'm getting error relating to staleTime

forest lava
#

Is it when you use staleTime or something else? @woeful gazelle

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

forest lava
woeful gazelle
#

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