Back to Urql

Integrating `@urql/exchange-retry`’s retryExchange

examples/with-retry/README.md

1.8.21.8 KB
Original Source

Integrating @urql/exchange-retry’s retryExchange

<p> <a href="https://stackblitz.com/github/urql-graphql/urql/tree/main/examples/with-retry"> </a> <a href="https://codesandbox.io/p/sandbox/github/urql-graphql/urql/tree/main/examples/with-retry"> </a> </p>

Integrating urql is as simple as:

  1. Install packages
sh
yarn add urql graphql
# or
npm install --save urql graphql
  1. Add retry exchange
sh
yarn add @urql/exchange-retry
# or
npm install --save @urql/exchange-retry
  1. Setting up the Client and adding the retryExchange here

  2. Execute the Query here

With Retry

This example shows urql in use with @urql/exchange-retry's retryExchange to implement retrying failed operations. This largely follows the "Retrying Operations" docs page and uses the trygql.formidable.dev/graphql/intermittent-colors schema, which emits a special NO_SOUP error randomly.

To run this example install dependencies and run the start script:

sh
yarn install
yarn run start
# or
npm install
npm run start

This example contains: