An exchange that dispatches active operations when the window regains focus
npm install @urql/exchange-refocus@urql/exchange-refocus is an exchange for the urql GraphQL client that tracks currently active operations and redispatches them when the
window regains focus
First install @urql/exchange-refocus alongside urql:
``sh`
yarn add @urql/exchange-refocusor
npm install --save @urql/exchange-refocus
Then add it to your Client, preferably before the cacheExchange and in front of any asynchronousfetchExchange
exchanges, like the :
`js
import { createClient, cacheExchange, fetchExchange } from 'urql';
import { refocusExchange } from '@urql/exchange-refocus';
const client = createClient({
url: 'http://localhost:3000/graphql',
exchanges: [refocusExchange({
// The minimum time in milliseconds to wait before another refocus can trigger. Default value is 0.
minimumTime: 2000
}), cacheExchange, fetchExchange],
});
``