in src/utils/xyPropsEqual.js [55:88]
export function xyPropsEqualDebug(
propsA,
propsB,
customKeysToDeepCheck = [],
includeDefaults = true,
) {
const propKeysToDeepCheck = includeDefaults
? defaultPropKeysToDeepCheck.concat(customKeysToDeepCheck)
: customKeysToDeepCheck;
// debug version of xyPropsEqual which console.logs, for figuring out which props are failing equality check
// const start = performance.now();
const propKeysToSkipShallowCheck = propKeysToDeepCheck.concat('scale');
const result =
// most keys just get shallow-equality checked
shallowEqual(
omit(propsA, propKeysToSkipShallowCheck),
omit(propsB, propKeysToSkipShallowCheck),
) &&
propKeysToDeepCheck.every(key => {
const isDeepEqual = isEqual(propsA[key], propsB[key]);
if (!isDeepEqual) console.log(`xyProps: ${key} not equal`);
return isDeepEqual;
}) &&
['x', 'y'].every(key => {
const isScaleEqual = scaleEqual(propsA.scale[key], propsB.scale[key]);
if (!isScaleEqual) console.log(`xyProps: scale.${key} not equal`);
return isScaleEqual;
});
// console.log('xyProps isEqual', isEqual);
// console.log('took', performance.now() - start);
return result;
}