Skip to content

Stop pruning in nestedProperty? #1410

Closed
@alexcjohnson

Description

@alexcjohnson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions