Skip to content

Commit

Permalink
[RN] Hoist static deepDiffer options object (facebook#17303)
Browse files Browse the repository at this point in the history
  • Loading branch information
motiz88 authored and gaearon committed Nov 7, 2019
1 parent 61d3dd0 commit 38dd17a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@ type NestedNode = Array<NestedNode> | Object;
let removedKeys = null;
let removedKeyCount = 0;

const deepDifferOptions = {
unsafelyIgnoreFunctions: true,
};

function defaultDiffer(prevProp: mixed, nextProp: mixed): boolean {
if (typeof nextProp !== 'object' || nextProp === null) {
// Scalars have already been checked for equality
return true;
} else {
// For objects and arrays, the default diffing algorithm is a deep compare
return deepDiffer(prevProp, nextProp, {unsafelyIgnoreFunctions: true});
return deepDiffer(prevProp, nextProp, deepDifferOptions);
}
}

Expand Down

0 comments on commit 38dd17a

Please sign in to comment.