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.

Along with Plotly.react, it would be nice if we would never mutate gd.data and gd.layout, just make new changed objects and alert the user to the change. We can’t make this the default behavior in v1 since some users depend on gd.data and gd.layout keeping the identity of the objects they initially passed in - though there are some cases already where they are not. But that rule holds well enough that some folks depend on it, so immutability would have to be a config argument.

In general all of the plot modification methods except Plotly.react (Plotly.restyle, relayout, update, extendTraces etc…) modify gd.data and gd.layout in place to make the requested updates. Most (but not all) then emit an event you can use to see that the plot state has changed. But also there are modifications that happen automatically during drawing the plot, principally (if not entirely) pushing auto values (axis ranges, colorscale ranges) back to gd.data and gd.layout so that future minor updates don’t need to recalculate these. This too is something we might be able to avoid doing, but probably not until v2.

So there are two things we should do:

  • Make all updates to gd.data and gd.layout immutably, conditional on a config argument.
  • Streamline the way we alert the user that the state has changed, so that they can feed this new state back into their app state. It seems like once we have immutable changes, it might be possible without any changes to the events from plotly.js… the react wrapper would have to bind to all the events that might carry state changes initiated from the UI, and also check after every update initiated by the wrapper itself, whether gd.data === prevData and gd.layout === prevLayout… but seems like it would be much easier for the react wrapper if there were a single “new state” event that collects all of these.

See https://github.com/plotly/react-plotly.js/issues/43

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:12
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

39reactions
janoshcommented, Sep 3, 2019

Is there a PR for this yet or is this being developed internally?

10reactions
nicolaskruchtencommented, Feb 21, 2018

I’m a big fan of this idea and approach, as it seems to really close the gap between React’s view of the world and the way plotly.js works 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable auditd immutable mode without rebooting - Server Fault
Hello I've been tasked with fixing up a auditd policy but it's on a server that's actively being used and the policy installed...
Read more >
Why auditd starts with message "The audit system is in ...
Why auditd starts with message "The audit system is in immutable mode, no rules loaded"? Solution Verified - Updated December 22 2015 at ......
Read more >
4.1.18 Ensure the audit configuration is immutable (Scored)
In immutable mode, unauthorized users cannot execute changes to the audit system to potentially hide malicious activity and then put the audit ...
Read more >
Immutable Mode in Angular Grid component - Syncfusion
The immutable mode optimizes the Grid re-rendering performance by using the object reference and deep compare concept. When performing the Grid actions, ...
Read more >
RHEL 8 audit system must protect auditing rules from ...
In immutable mode, unauthorized users cannot execute changes to the audit system to potentially hide malicious activity and then put the ...
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