The syntax you've used seems to be incorrect. In Convex, the useQuery hook accepts two arguments: the query function and the arguments for that function. If you want to skip the query based on a condition, you should pass "skip" as the second argument when the condition is met.
Here's the correct syntax based on the information provided in the knowledge sources:
const doesUserHaveActiveRelationship = useMiscStore(
(state) => state.doesUserHaveActiveRelationship,
);
const {
data: momentMagicRatioData,
isPending: isPendingMomentMagicRatioData,
} = useQueryWithStatus(
api.insights.getCurrentMagicRatio,
doesUserHaveActiveRelationship ? {
type: "moment",
perspective: "personal",
} : "skip"
);
In this code, if doesUserHaveActiveRelationship is true, the query arguments are passed to useQueryWithStatus. If doesUserHaveActiveRelationship is false, "skip" is passed, which means the query won't be run.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: