Skip to content

v2.4.0

Compare
Choose a tag to compare
@nodkz nodkz released this 19 Sep 16:01
· 67 commits to master since this release

2.4.0 (2018-09-19)

Features

  • Retry middleware now retries on fetch error; added a new beforeRetry configurable callback (4e4f54a) (thanks @ntelkedzhiev)
  • avoid unhandled promise rejection error (a0167ed)
  • all internal errors now extends RRNLError, export all errors (849ac00)
  • enable executeWithEvents method in RelayNetworkLayer class (f0df76c)

Deprecated

  • In Retry middleware was deprecated forceRetry configuration property in favor of new more powerful beforeRetry callback (4e4f54a)
const network = new RelayNetworkLayer(
  [
    retryMiddleware({
      fetchTimeout: 15000,
      retryDelays: attempt => Math.pow(2, attempt + 4) * 100, // or simple array [3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600],
-      forceRetry: (cb, delay) => {
-        window.forceRelayRetry = cb;
-        console.log('call `forceRelayRetry()` for immediately retry! Or wait ' + delay + ' ms.');
-      },
+      beforeRetry: ({ forceRetry, abort, delay, attempt, lastError, req }) => {
+        window.forceRelayRetry = forceRetry;
+        console.log('call `forceRelayRetry()` for immediately retry! Or wait ' + delay + ' ms.');
+      },
      statusCodes: [500, 503, 504],
    }),
  ],
  opts
);