Add lazyQuery option #393
-
Currently we have to pass args as second param and have to manually check if args is not undefined const {data} = useQuery(['post', postId]); it would be better to have full control on when to trigger query like for example searching posts const [searchPosts] = useLazyQuery('search_posts', searchPostsHandler);
searchPosts({
variables: {
post_id: 1
}
}) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Isn’t this the same as using the “manual“ option? |
Beta Was this translation helpful? Give feedback.
-
I see, you don't want to pass the variables until you want to call it. With that expectation, how would I am having a hard time seeing how this pattern would benefit from the same things that useQuery and the like do. I'm going to turn this into a discussion so we can talk about the use cases more. |
Beta Was this translation helpful? Give feedback.
I see, you don't want to pass the variables until you want to call it. With that expectation, how would
useLazyQuery
know what data to fetch from the cache? How would it know when to update?I am having a hard time seeing how this pattern would benefit from the same things that useQuery and the like do.
I'm going to turn this into a discussion so we can talk about the use cases more.