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

Inifinite calling of onError in query hoc #2477

@stefan-krajnik

Description

@stefan-krajnik

Intended outcome:
I expect onError to be called only once when a response is received.

Actual outcome:
I have a mutation (@client) which I call in onError, but the mutation seems to be triggering some process in which onError (with same error from the request call) is called again

How to reproduce the issue:
Here is the block of code I'm using.
Note: if I don't call createNotification everything works as expected

export default compose(
  graphql(createNotificationMutation, { name: 'createNotification' }),
  graphql(someQuery, {
    name: 'someQuery',
    options: ({ createNotification }) => ({
      variables: {
        // ....
      },
      notifyOnNetworkStatusChange: true,
      onError: (err) => {
        createNotification({
          variables: {
            data: {
              text: err.message,
              isError: true,
            },
          },
        })
      },
    }),
  }),
)(MyComponent)

Version

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions