Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix issue with ssr-exchange looping for reexecuted ops (#1944)

authored by

Jovi De Croock and committed by
GitHub
63eec7eb b90b6d5e

+9 -1
+5
.changeset/flat-queens-refuse.md
··· 1 + --- 2 + '@urql/core': patch 3 + --- 4 + 5 + Fix issue where the ssr-exchange would loop due to checking network-only revalidations
+4 -1
packages/core/src/exchanges/ssr.ts
··· 80 80 hasNext: result.hasNext, 81 81 }); 82 82 83 + const revalidated = new Set<number>(); 84 + 83 85 /** The ssrExchange can be created to capture data during SSR and also to rehydrate it on the client */ 84 86 export const ssrExchange = (params?: SSRExchangeParams): SSRExchange => { 85 87 const staleWhileRevalidate = !!(params && params.staleWhileRevalidate); ··· 128 130 map(op => { 129 131 const serialized = data[op.key]!; 130 132 const result = deserializeResult(op, serialized); 131 - if (staleWhileRevalidate) { 133 + if (staleWhileRevalidate && !revalidated.has(op.key)) { 132 134 result.stale = true; 135 + revalidated.add(op.key); 133 136 reexecuteOperation(client, op); 134 137 } 135 138