diff --git a/packages/python/plotly/plotly/basedatatypes.py b/packages/python/plotly/plotly/basedatatypes.py index 0639dc68050..a423ae11978 100644 --- a/packages/python/plotly/plotly/basedatatypes.py +++ b/packages/python/plotly/plotly/basedatatypes.py @@ -642,8 +642,9 @@ def data(self, new_data): # ### Check whether a move is needed ### if not all([i1 == i2 for i1, i2 in zip(new_inds, current_inds)]): - # #### Update widget, if any #### - self._send_moveTraces_msg(current_inds, new_inds) + # #### Save off index lists for moveTraces message #### + msg_current_inds = current_inds + msg_new_inds = new_inds # #### Reorder trace elements #### # We do so in-place so we don't trigger traitlet property @@ -664,6 +665,9 @@ def data(self, new_data): for ni, trace_data in zip(new_inds, moving_traces_data): self._data.insert(ni, trace_data) + # #### Update widget, if any #### + self._send_moveTraces_msg(msg_current_inds, msg_new_inds) + # ### Update data defaults ### # There is to front-end syncronization to worry about so this # operations doesn't need to be in-place