Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(graphcache): case where a mutation would also be counted in the loop-protection #2761

Merged
merged 3 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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