apollo
apollo copied to clipboard
useLazyQuery requires the document again when calling `load`
Describe the bug
A clear and concise description of what the bug is.
When destructuring load from useLazyzQuery, you need to provide the query again for some reason, eventhough it should already be provided.
Example:
const { load } = useLazyQuery<GetCollection, GetCollectionVariables>(GET_COLLECTION)
const doThing = async () => {
load({ id: '1' }) // Error, because the first argument is the document, even though it's already passed into `useLazyQuery`
}
// This works
const doOtherThing = async () => {
load(GET_COLLECTION, { id: '1' })
}
To Reproduce Steps to reproduce the behavior:
- Destructure
loadfromuseLazyQuerywith a provided document - Call load in some secondary function with just the variables
- You should see an error in your IDE, because
documentis the first argument
Expected behavior
load to already know the document (as it's passed into useLazyQyery) and just be able to call it with variables, just like you do with mutations.
Versions vue: 3.2.36 vue-apollo: 4.0.0-alpha.16 @apollo/client: 3.5.10