apollo-client: exception in suspense query: Cannot read properties of undefined (reading 'errors')

Issue Description

I sometimes see the following error, which I believe indicates a bug in the apollo library. I should mention that I think this happens when my component gets into an infinite rerender loop (so I’m probably screwing something up), but it looks to me like Apollo has a problem nonetheless; the error is seen after a handful of render iteration in this loop.

Cannot read properties of undefined (reading 'errors')
    at toApolloError (useSuspenseQuery.ts:321:33)
    at useSuspenseQuery.ts:227:19
    at updateMemo (react-dom.development.js:17246:19)
    at Object.useMemo (react-dom.development.js:17886:16)
    at Object.useMemo (react.development.js:1650:21)
    at useSuspenseQuery (useSuspenseQuery.ts:226:28)
    at Login (login.tsx:143:25)
    at renderWithHooks (react-dom.development.js:16305:18)
    at updateFunctionComponent (react-dom.development.js:19588:20)
    at beginWork (react-dom.development.js:21601:16)

Link to Reproduction

N/A

Reproduction Steps

No response

@apollo/client version

3.9.5

About this issue

  • Original URL
  • State: open
  • Created 4 months ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

@jerelmiller you are right, I was confused by the error, but those 2 look different

I’ve filed an issue here: https://github.com/apollographql/apollo-client/issues/11800

feel free to delete the thread if it helps

unfortunately, this is all I have so far,

I don’t understand why one suspense throws an error to handle by upper components in case of gql failure and another returns an error and an empty result, not even having a clue where to look for a hint. The absence of loading attribute is the only difference between suspense and original query hooks.

I’ll add more details if I figure out what causes the difference.

PS. In any case, I appreciate the effort, and thanks for the package, guys!