Skip to content

lazyQuery - double network call  #9448

@nudelx

Description

@nudelx

Hi
I have updated my @apollo/client from 3.50 to the latest release 3.5.8
and I have an issue with the lazyQuery, which creates double network calls:

Example

 const [getUserInfo, { data, error, called, networkStatus }] =  useLazyQuery(GET_USER_INFO)
 
  useEffect(() => {
    if (total === 42) {
      console.log('call for user info')
      getUserInfo()
    }
  }, [total, getUserInfo])
 

When running this useEffect hook, I see the console log message issued only once. However, the server executes the
query twice in the DB and I see two network calls in the browser inspect

OPTIONS OPTIONS FETCH FETCH
and following these, 2 queries in the DB.
I tried to use fetchingPolicies but without any success
when I downgrade to 3.5.0 then it works as expected

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions