Skip to content

Commit 9877e1f

Browse files
committed
Don't initialize uid on traces in frames
This was causing animation bugs
1 parent a50f492 commit 9877e1f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

_plotly_utils/basevalidators.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,11 +1864,18 @@ def validate_coerce(self, v):
18641864

18651865
class BaseDataValidator(BaseValidator):
18661866

1867-
def __init__(self, class_strs_map, plotly_name, parent_name, **kwargs):
1867+
def __init__(self,
1868+
class_strs_map,
1869+
plotly_name,
1870+
parent_name,
1871+
set_uid=False,
1872+
**kwargs):
18681873
super(BaseDataValidator, self).__init__(
18691874
plotly_name=plotly_name, parent_name=parent_name, **kwargs)
1875+
18701876
self.class_strs_map = class_strs_map
18711877
self._class_map = None
1878+
self.set_uid = set_uid
18721879

18731880
def description(self):
18741881

@@ -1957,8 +1964,9 @@ def validate_coerce(self, v):
19571964
v = to_scalar_or_list(res)
19581965

19591966
# Set new UIDs
1960-
for trace in v:
1961-
trace.uid = str(uuid.uuid1())
1967+
if self.set_uid:
1968+
for trace in v:
1969+
trace.uid = str(uuid.uuid1())
19621970

19631971
else:
19641972
self.raise_invalid_val(v)

plotly/basedatatypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class is a subclass of both BaseFigure and widgets.DOMWidget.
119119
# ### Construct data validator ###
120120
# This is the validator that handles importing sequences of trace
121121
# objects
122-
self._data_validator = DataValidator()
122+
self._data_validator = DataValidator(set_uid=True)
123123

124124
# ### Import traces ###
125125
data = self._data_validator.validate_coerce(data)

0 commit comments

Comments
 (0)