-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
How to use Apollo useLazyQuery hook without a constant query (graphql-tag) ? #9889
Comments
Thank you for reporting this! I'd recommend posting this in our Apollo Community for guidance from other Apollo users, as other's may have input into your question. I'll leave this open for a while to see if anyone in the community has any suggestions as well. |
Thank you for your answer. As advised I posted it on the Apollo Community ! |
Hey @antoine-dupuy 👋 I hope you were able to get the help you needed in the forum! Since some time has passed, I'm going to go ahead and close this. Thanks! |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi everyone, I try to use the useLazyQuery hook with dynamic tag and variables without success so far !
I have a first useQuery who fetch some objects that contain the query I need in my second call. Here my issues begin.
I tried to put a "dummy" query in my second call while waiting for my data and reset it before I use the useLazyQuery getData() callback but I can't get it to work. I have my data in the network tab but the callback return by useLazyQuery doesn't return my data.
I taught to use the skip option of useQuery but I don't think that's the best approach because I'm fetching in response to an event hence the use of useLazyQuery.
I tried several hacks and read many post without finding an answer so far. I don't know if my issue is only related to Apollo or to the relation between react and Apollo hooks.
TLDR, What I try to do: How to handle multiple queries depending on each other.
1- fetch data with useQuery on initial render
2- fetch data with useLazyQuery based on a query contained in the previously fetch data
3- render data from step 2 using the useLazyQuery returned function
Thank you in advance for your help.
The text was updated successfully, but these errors were encountered: