Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
at main 36 lines 1.0 kB view raw view rendered
1--- 2title: '@urql/exchange-refocus' 3order: 11 4--- 5 6# Refocus Exchange 7 8> **Note:** These API docs are deprecated as we now keep TSDocs in all published packages. 9> You can view TSDocs while using these packages in your editor, as long as it supports the 10> TypeScript Language Server. 11> We're planning to replace these API docs with a separate web app soon. 12 13`@urql/exchange-refocus` is an exchange for the `urql` that tracks currently active operations and redispatches them when the 14window regains focus 15 16## Quick Start Guide 17 18First install `@urql/exchange-refocus` alongside `urql`: 19 20```sh 21yarn add @urql/exchange-refocus 22# or 23npm install --save @urql/exchange-refocus 24``` 25 26Then add it to your `Client`, preferably in front of your `cacheExchange` 27 28```js 29import { createClient, cacheExchange, fetchExchange } from 'urql'; 30import { refocusExchange } from '@urql/exchange-refocus'; 31 32const client = createClient({ 33 url: 'http://localhost:3000/graphql', 34 exchanges: [refocusExchange(), cacheExchange, fetchExchange], 35}); 36```