-
-
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it. Nice refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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,
relayout
is 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
newItemIndex
is beyond the current container length.