-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop pruning in nestedProperty? #1410
Comments
I can imagine it would work, but is it too ugly to use a flag in the plot schema to prevent pruning but allow it by default? |
Ohhh, never mind. Yeah, that's the coupling obviously. Then my vote is to allow pruning, or at least move pruning to a dedicated step that is aware of the plot schema and perhaps not run so frequently. |
and worse, |
Yeah, I think it's excellent to keep it fully decoupled and (as) unaware of the schema (as possible). It seems to me like pruning is both a perfectly nice/valid thing and also something that shouldn't be related to nested properties. |
cc @bpostlethwaite and @VeraZab can you think of any potential problems that stopping pruning empty containers could cause in W2? |
I'm not sure I understand what the situation would look like without pruning.. Of the top of my head, I can think of one situation where we use |
@VeraZab I don't think anything would change in how you call Calls like |
@alexcjohnson thanks for the clarification. |
Update: I notice one case that
Changing that will probably have to wait for v2... interestingly once you have a Anyway, unless something has changed in the 14 months 🙄 that this issue has lain dormant, seems like we're agreed that we can 🔪 the pruning check. I need to remove it at least within |
More on the range slider topic. Here's one weird test: plotly.js/test/jasmine/tests/range_slider_test.js Lines 376 to 387 in 4ed586a
that uses plotly.js/test/jasmine/tests/range_slider_test.js Lines 389 to 422 in 4ed586a
are a little aligned with the rest of our components. |
As I wrote in a private convo yesterday, 👍 for 🔪ing the prune check during |
Right, I guess I'm arguing for not even pruning In fact... currently we also prune plotly.js/src/lib/nested_property.js Line 138 in 4ed586a
yet there too we have a note:
Honestly this has probably never actually happened to a user - using |
I'm big fan of making As a side-note, making |
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.
The text was updated successfully, but these errors were encountered: