Skip to content

Commit

Permalink
fix(graphcache): case where a mutation would also be counted in the l…
Browse files Browse the repository at this point in the history
…oop-protection (#2761)
  • Loading branch information
JoviDeCroock authored Oct 25, 2022
1 parent 7d9ba14 commit 15482d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/flat-feet-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@urql/exchange-graphcache": patch
---

Fix case where a mutation would also be counted in the loop-protection, this prevented partial queries from initiating refetches
4 changes: 3 additions & 1 deletion exchanges/graphcache/src/cacheExchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ export const cacheExchange = <C extends Partial<CacheExchangeOpts>>(
// Upon completion, all dependent operations become reexecuting operations, preventing
// them from reexecuting prior operations again, causing infinite loops
const _reexecutingOperations = reexecutingOperations;
(reexecutingOperations = dependentOperations).add(operation.key);
if (operation.kind === 'query') {
(reexecutingOperations = dependentOperations).add(operation.key);
}
(dependentOperations = _reexecutingOperations).clear();
};

Expand Down

0 comments on commit 15482d8

Please sign in to comment.