···11+---
22+'@urql/exchange-request-policy': minor
33+---
44+55+Change the request-policy exchange not to rely on OperationMeta set by the cache exchanges
···5757 ({ forward }) => {
5858 const operations = new Map();
5959 const TTL = (options || {}).ttl || defaultTTL;
6060+ const dispatched = new Map<number, number>();
6161+ let counter = 0;
60626163 const processIncomingOperation = (operation: Operation): Operation => {
6264 if (
···6870 }
69717072 const currentTime = new Date().getTime();
7373+ // When an operation passes by we track the current time
7474+ dispatched.set(operation.key, counter);
7575+ queueMicrotask(() => {
7676+ counter = (counter + 1) | 0;
7777+ });
7178 const lastOccurrence = operations.get(operation.key) || 0;
7279 if (
7380 currentTime - lastOccurrence > TTL &&
···8390 };
84918592 const processIncomingResults = (result: OperationResult): void => {
8686- const meta = result.operation.context.meta;
8787- const isMiss = !meta || meta.cacheOutcome === 'miss';
8888- if (isMiss) {
9393+ // When we get a result for the operation we check whether it resolved
9494+ // synchronously by checking whether the counter is different from the
9595+ // dispatched counter.
9696+ const lastDispatched = dispatched.get(result.operation.key) || 0;
9797+ if (counter !== lastDispatched) {
9898+ // We only delete in the case of a miss to ensure that cache-and-network
9999+ // is properly taken care of
100100+ dispatched.delete(result.operation.key);
89101 operations.set(result.operation.key, new Date().getTime());
90102 }
91103 };