Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Better support for multiple useLazyQuery execution function calls #3453

Merged
merged 3 commits into from Sep 3, 2019

Conversation

hwillson
Copy link
Member

@hwillson hwillson commented Sep 3, 2019

Before this PR, calling a useLazyQuery execution function multiple times in a row, when using a fetch policy of network-only, lead to unexpected results. Only the first network request was submitted as Apollo Client was blocking subsequent requests, since the query, fetch policy and variables remained the same. This commit adds additional cleanup to the useLazyQuery execution function, such that each call will start a new ObservableQuery instance. This means each query fired by the useLazyQuery execution function is treated as a fully new query.

Fixes #3355.

Before this commit, calling a `useLazyQuery` exection function
multiple times in a row, when using a fetch policy of
`network-only`, lead to unexpected results. Only the first network
request was submitted as Apollo Client was blocking subsequent
requests, since the query, fetch policy and variables remained
the same. This commmit adds additional cleanup to the
`useLazyQuery` exection function, such that each call will start
a new `ObservableQuery` instance. This means each query fired
by the `useLazyQuery` execution function is treated as a fully
new query.

Fixes #3355.
@hwillson hwillson merged commit 3c05b08 into master Sep 3, 2019
@hwillson hwillson deleted the issue-3355 branch September 3, 2019 12:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useLazyQuery ignores fetchPolicy 'network-only'
1 participant