diff --git a/.changeset/lazy-kangaroos-think.md b/.changeset/lazy-kangaroos-think.md new file mode 100644 index 0000000000..6efbe2ad88 --- /dev/null +++ b/.changeset/lazy-kangaroos-think.md @@ -0,0 +1,5 @@ +--- +"@urql/exchange-graphcache": patch +--- + +Disregard write-only operation when fragment-matching with schema awareness diff --git a/exchanges/graphcache/src/operations/shared.ts b/exchanges/graphcache/src/operations/shared.ts index 4dad5e0900..bb1893a3fe 100644 --- a/exchanges/graphcache/src/operations/shared.ts +++ b/exchanges/graphcache/src/operations/shared.ts @@ -236,7 +236,10 @@ export function makeSelectionIterator( ctx.store.logger )); - if (isMatching || currentOperation === 'write') { + if ( + isMatching || + (currentOperation === 'write' && !ctx.store.schema) + ) { if (process.env.NODE_ENV !== 'production') pushDebugNode(typename, fragment); const isFragmentOptional = isOptional(select);