question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New onDirectUpdate callback triggerered on render

See original GitHub issue

It 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:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolaskruchtencommented, Oct 2, 2018

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, well if I just don’t set the state everything seems to work fine (See plotly/jupyterlab-chart-editor@2374ee9 https://github.com/plotly/jupyterlab-chart-editor/commit/2374ee94665d7b8b5e725d4904d26fb3efd42092 )

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/plotly/react-chart-editor/issues/751#issuecomment-426107963, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMbAwXp6ijdc6EUQhc3TPNN2Fw37hMvks5ugrRAgaJpZM4XDG3m .

0reactions
nicolaskruchtencommented, Oct 2, 2018

OK, this change was published as v0.31.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Work with DirectX device resources - Win32 apps
Creating a Microsoft DirectX game for Windows is a challenge for a new developer. Here we quickly review the concepts involved and the...
Read more >
DirectX® 9 Gauges - Prepar3D
The DirectX® for the gauge must be obtained on each pass through the gauge's update callback code. This is to ensure that the...
Read more >
3ds Max 2017 Help: General Event Callback Mechanism
This registers a new callback script that will be called just before a render is performed. The script invokes a function (that has...
Read more >
Order of execution for event functions - Unity - Manual
OnStateMachineExit: During the State Machine Update step, this callback is called on the last update frame when a controller's state machine makes a...
Read more >
API Reference — bgfx 1.118.8367 documentation
Callback interface to implement application specific behavior. Cached items are currently used for OpenGL and Direct3D 12 binary shaders. Remark. 'fatal' and ' ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found