Consistent container update / removal #1086
Conversation
|
I made a PR right now even this is a WIP as this was the last remaning item in the TODO:
|
| 'sliders', | ||
| 'updatemenus' | ||
| ]); | ||
| return plots.extendObjectWithContainers(destLayout, srcLayout, plots.layoutArrayContainers); |
There was a problem hiding this comment.
Yep. I thought exposing plots.layoutArrayContainers was a nice compromise.
Next step would be to auto-generate that list using the plot-schema. (later ...)
|
Outstanding! What happens to the surrounding indices when you do that? Presumably it's up to the user/front-end to manage references to non-existent array elements. Like if you have |
- to be used in relayout / restyle
- at the moment that means 'on restyle involving transforms'
- by using manageArrayContainers
- to be part with other array containers
a07716d to
010c792
Compare
you have That is, |
|
Is there a place we can add a deprecation notice about the 'add' and 'remove' API? Do any docs need updating? Should we add an issue in the Plotlyjs 2.0 to remove 'add' and 'remove' as part of that Milestone? |
|
💃 for the PR. Just a few questions |
I don't any reference of
Good call. I'll add it to #420 |
|
@etpinard That makes sense. I'll only point out the obvious possibility of writing code that references other items by array index. |
fixes #1069
Currently,
relayoutis allowed to be called with 💠 special 💠'add'and'remove'values for annotations and shapes. For example,which gets the job done, but is a little sloppy. We can do better and luckily
'add'and'remove'we're never implemented for the new (e.g. images, updatemenus, sliders, mapbox layers) layout array containers.This PR enforces,
as a way to delete items in containers found in layout. Similarly,
will delete transform item in the relevant trace(s).
Moreover,
will consistently add items to the array container if
newItemIndexis beyond the current container length.