Mick Staugaard
Mick Staugaard

Reputation: 76

How do you retry a relay transaction

How do I tell relay that it should retry a transaction that failed?

Upvotes: 0

Views: 827

Answers (1)

XuoriG
XuoriG

Reputation: 610

As far as I know Relay does not retry failed mutations (transactions) automatically, but it does retry Queries according to your NetworkLayer config like this

Relay.injectNetworkLayer(
  new Relay.DefaultNetworkLayer('http://example.com/graphql', {
    fetchTimeout: 30000,   // Timeout after 30s.
    retryDelays: [5000],   // Only retry once after a 5s delay.
  })
);

For mutations you can use getPendingTransactions to get the transactions on a record, check the transaction status, and recommit if needed.

This might help you: https://github.com/facebook/relay/blob/master/docs/APIReference-Container.md#getpendingtransactions

Upvotes: 2

Related Questions