I've started to use Tanstack Router after I converted my Next.js project to Tanstack Start.
Before I used this function to not make my queries run all the time:
export const useStableQuery = ((globalKey, query, ...args) => {
const { status, data, error } = useQuery(query, ...args)
const convex = useConvex()
const cache = ((convex as any).cache ??= {})
if (status === "success" && data !== undefined) {
cache[globalKey] = data
}
return {
status,
data: cache[globalKey],
error,
isSuccess: status === "success",
isPending: status === "pending",
isError: status === "error",
}
}) as QueryWithGlobalCacheKey
Is there a similar way of implementing this behaviour? I have looked at query keys, but I'm not sure if that will work when using Convex?