@samitouri / QOS-React-2 / commits / 38dd17ab98

[RN] Hoist static deepDiffer options object (#17303)

Moti Zilberman committed Nov 7, 2019 at 08:03 UTC 38dd17ab98ce288fd0d0b68682a6df0f0a49e158
1 file changed +5 -1
packages/react-native-renderer/src/ReactNativeAttributePayload.js
+5 -1
@@ -32,13 +32,17 @@ type NestedNode = Array<NestedNode> | Object;
32 let removedKeys = null;
33 let removedKeyCount = 0;
34
35 +const deepDifferOptions = {
36 + unsafelyIgnoreFunctions: true,
37 +};
38 +
39 function defaultDiffer(prevProp: mixed, nextProp: mixed): boolean {
40 if (typeof nextProp !== 'object' || nextProp === null) {
41 // Scalars have already been checked for equality
42 return true;
43 } else {
44 // For objects and arrays, the default diffing algorithm is a deep compare
41 - return deepDiffer(prevProp, nextProp, {unsafelyIgnoreFunctions: true});
45 + return deepDiffer(prevProp, nextProp, deepDifferOptions);
46 }
47 }
48