apollo-client: Cannot read properties of undefined (reading 'data')

Issue Description

Hi! We are getting these error randomly:

// node_modules/@apollo/client/react/hooks/useQuery.js in InternalState.prototype.toQueryResult at line 440:27
InternalState.prototype.toQueryResult = function (result) {
        var queryResult = this.toQueryResultCache.get(result);
        if (queryResult)
            return queryResult;
      // Next line, where result could be undefined ?
        var data = result.data, partial = result.partial, resultWithoutPartial = __rest(result, ["data", "partial"]);
        this.toQueryResultCache.set(result, (queryResult = __assign(__assign(__assign({ data: data },

Link to Reproduction

None

Reproduction Steps

No response

@apollo/client version

3.9.11

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (12 by maintainers)

Most upvoted comments

@jerelmiller for reproducing i think if you will hit multiple queries and then you will expire the token then in that queries i think you will get this error. Because i don’t know deep about this.

All of that code has been rewritten from the ground in newer versions of Apollo Client - could you please update to a current version? 😃

Oh! I’m updating now, thanks! I’ll let you know the results after