Skip to content

Commit

Permalink
Skip warning about clobbering deeply equal data.
Browse files Browse the repository at this point in the history
This should have been part of #6372 (just merged).
  • Loading branch information
benjamn committed Jun 1, 2020
1 parent 6cb48af commit 96a591a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cache/inmemory/writeToStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SelectionSetNode, FieldNode, DocumentNode } from 'graphql';
import { invariant, InvariantError } from 'ts-invariant';
import { equal } from '@wry/equality';

import {
createFragmentMap,
Expand Down Expand Up @@ -346,6 +347,10 @@ function warnAboutDataLoss(
// safely stored elsewhere.
if (isReference(existing)) return;

// If the values are structurally equivalent, we do not need to worry
// about incoming replacing existing.
if (equal(existing, incoming)) return;

// If we're replacing every key of the existing object, then the
// existing data would be overwritten even if the objects were
// normalized, so warning would not be helpful here.
Expand Down

0 comments on commit 96a591a

Please sign in to comment.