How to enable tRPC (v10) queries that don't have data passed in them
Just updated to trpc v10 and have no idea how to enable/disable queries. Couldn't find anything in the docs. Here is what I'm trying that doesn't work:
trpc.subscription.getUserSubscription.useQuery(undefined, { enabled: !!user?.customer && !!user.individual })
4 Replies
It is correct
You just need to check is the enabled value is correct
Usually logging helps
Ok I figured something out. Despite the enabled value being false, the query is still returning isLoading true indefinitely
How do I make this baby not run
In case anyone else ends up here to do similar problems: https://github.com/TanStack/query/issues/3584
GitHub
[Beta] Disabled query has
isLoading: true
property · Issue #3584 ...Describe the bug In react-query@beta version has strange behaviour. By default query that has enabled: false option has isLoading: true property (see code sandbox for details). In stable release re...
This ended up giving me the answer I needed