-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependent queries are not working with tanstack query #5
Comments
For anyone looking for a workaround, you can use the non-TanStack hook const ordersResponse = useConvexQuery(
api.orders.getOrdersByCartIds,
!!cartDocIds?.length ? { cartDocIds: cartDocIds ?? [], fetchProducts: true }) : "skip"
// "skip" is a special value that causes the query not to run https://docs.convex.dev/client/react#skipping-queries
}); We should support this though, shouldn't be hard. |
Why not just this method below? const convex = useConvex();
// later
const result = await convex.query(api.asd); |
The dependent queries @Irutom wants here are still reactive, just off sometimes when the arguments aren't available. |
This works for "skip" now, but not |
@thomasballinger Could you clarify whether you’re referring to tanstack’s useQuery or convex’s useConvexQuery()? An example would be helpful for better understanding. |
@Irutom here's an example convex-react-query/src/example.tsx Line 72 in 9362c61
This is convexQuery used to create options for TanStack's useQuery. |
Convex query is executed even if the enabled condition is not met.
Query
Below is the error
https://tanstack.com/query/latest/docs/framework/react/guides/dependent-queries
The text was updated successfully, but these errors were encountered: