Skip to content
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

What is the useLazyQuery alternative to useSuspense and useBackgroundQuery? #150

Closed
sa-ma opened this issue Dec 3, 2023 · 4 comments
Closed
Labels
question Further information is requested

Comments

@sa-ma
Copy link

sa-ma commented Dec 3, 2023

useLazyQuery allowed us to fetch data when it was needed and not at runtime but I don't see a way to do that with useSuspense. I tried the skipToken on useBackgroundQuery but the companion useReadQuery throws a Typescript error saying queryRef cannot be undefined

@jerelmiller
Copy link
Member

Hey @sa-ma 👋

We have a new hook coming in 3.9 called useLoadableQuery that I think is what you're looking for. We should be releasing this in the next alpha version if you're interested in trying it out!

@jerelmiller jerelmiller added the question Further information is requested label Dec 3, 2023
@sa-ma
Copy link
Author

sa-ma commented Dec 8, 2023

Hey @sa-ma 👋

We have a new hook coming in 3.9 called useLoadableQuery that I think is what you're looking for. We should be releasing this in the next alpha version if you're interested in trying it out!

I will. Thanks.

@phryneas
Copy link
Member

Apollo Client 3.9 has been released with useLoadableQuery, so I think this has been answered sufficiently :)

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants