Description
Lib.nestedProperty
started as a nice compact, decoupled way to manage edits to traces and layout objects. We have a system that prunes empty containers, which was originally meant so that unnecessary pieces would not be left around after multiple operations. For example, you have a line trace with default properties:
{x: [1, 2, 3], y: [1, 2, 3]}
then you edit the line color restyle(gd, {'line.color': 'red'})
{x: [1, 2, 3], y: [1, 2, 3], line: {color: 'red'}}
And you don't like that, so you undo it restyle(gd, {'line.color': null})
. Without pruning you get:
{x: [1, 2, 3], y: [1, 2, 3], line: {}}
Which is functionally the same, but it's not a perfect undo.
However, some empty containers cannot be removed (see #1403 (comment) and #1403 (comment) ) so this has gotten too coupled to our particular JSON structure. Can we live without doing any pruning since it would simplify the logic so much? @etpinard and I are leaning toward doing that but wanted to invite discussion.