React-apollo: onError called more then once

Created on 9 Aug 2019  路  3Comments  路  Source: apollographql/react-apollo

I had to use debounce to stop the error from following twice.

    const x = _.debounce((error) => {
      try {
        if (error) Handle.graphqlErrors(error)
      } catch {

      }
    }, 1000)

    const [onLoad] = useLazyQuery(getQuery(query), { onError: x})

Not sure if this is expected behavior. I would expect it only to be fired once time.

Most helpful comment

I'm still seeing this in v3.0.1 #3407

All 3 comments

@hwillson My thoughts about this issue are here: https://github.com/apollographql/react-apollo/issues/2559#issuecomment-517479315

I'm still seeing this in v3.0.1 #3407

I'm still seeing this in v3.0.1 #3407

I am also facing same issue in version 3.1.5
The API is being called once but if I console something thee function that renders HTML from react.
It runs twice after getting data.loading = 'false'

Was this page helpful?
0 / 5 - 0 ratings