Add lazyQuery option #393
Answered
by
tannerlinsley
krunaldodiya
asked this question in
General
|
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
}
}) |
Answered by
tannerlinsley
Apr 23, 2020
Replies: 2 comments 6 replies
|
Isn’t this the same as using the “manual“ option? |
1 reply
|
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. |
5 replies
Answer selected by
krunaldodiya
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see, you don't want to pass the variables until you want to call it. With that expectation, how would
useLazyQueryknow 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.