New onDirectUpdate callback triggerered on render
See original GitHub issueIt seems that the new onDirectUpdate
callback added in https://github.com/plotly/react-chart-editor/pull/749 is executed on render as well as on direct manipulation of the plot.
The JupyterLab extension currently registers an onUpdate
callback that is executed when the user manipulates the figure using the React widgets. This callback is used to set the state of the extension’s ChartEditor
component.
I tried to register the same callback function with the new onDirectUpdate
property and ended up in an infinite loop. I think what’s happening is that rendering PlotlyEditor
is triggering the onDirectUpdate
callback, which then calls setState
, which then causes another render
, and on and on.
Please let me know if I’m misunderstanding something here about the intended use of onDirectUpdate
. But I’m wondering if it would be possible for onDirectUpdate
to not execute on the initial render, and only in response to mouse interactions.
Or alternatively, should the onDirectUpdate
callback function not be calling setState
at all? Because the plotly figure was already updated internally?
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Yeah, the PlotlyEditor keeps its own state so that should work. It’s a pretty brittle system, prone to infinite loops unfortunately. I’ll still likely rename that function just for clarity, sorry for the churn.
On Mon, Oct 1, 2018 at 20:33 Jon Mease notifications@github.com wrote:
OK, this change was published as v0.31.1