why-did-you-render
why-did-you-render copied to clipboard
Objects are equal when saved to the console
Process:
I was getting output from the tool that told me that the two objects were equal by value but not by ref. OK, so I save them both to globals. But they were equal by ref in that case: temp1 === temp2 // true
(red line in screenshot)
But the diffs in the diffs array (which I saved to a global ref from the diffsAccumulator.push
line while debugging the wdyr code) e.g. diffs[0].nextValue === diffs[0].prevValue
say the two objects are not equal by ref (green line in screenshot)
The output is confusing if I get different results for equality when accessing the same objects from the console output vs the diffs array. I tried using a stringify (with a replace for circular refs, which could be the issue) and found that the two serialized values were identical.
This is a confusing result.