Comments (8)
Note that right now if you click legend HIDE the positioning field still shows up as MenuPanel triggers section visibility . We should turn that off and test.
from react-chart-editor.
<Section>
is passing in its context to unpackPlotProps
which may be different than the context received by the children. For example if you have a structure like this:
<TraceConnectedPanel />
<Section />
<LayoutConnectedField />
<Section>
will only see TraceConnected
context objects and unpackPlotProps
will return a different value then what will be computed by its <LayoutConnectedField>
child. This is really bad... since the visibility will be computed incorrectly.
This is blocking adding layout attributes inside a Tracepanel. For example boxgap
and friends.
cc @alexcjohnson sorta stuck on this one. We may have to rethink the way visibility is handled...
from react-chart-editor.
https://medium.com/@mweststrate/how-to-safely-use-react-context-b7e343eff076 Hmmm we may have to rethink our use of context period.
from react-chart-editor.
One way would be to also define defaultProps for the container attr like fullLayout
or fullData
. Then the <Section>
will see that prop and could use it. This would be set on the higher order component like connectLayoutToPlot
.
I'll investigate that.
from react-chart-editor.
So this is all <Section>
s fault. We need to work around the fact that <Section>
precomputes plotProps using the wrong context. This has 2 negative side effects.
First is that it just computes the wrong visibility for the field. Second, once it has computed the wrong plotProps the default behaviour of a connectToContainer
component is to not recompute them but simply used the ones passes to it by <Section>
(or whatever parent). This saves some computation for all the components nested in <Section>
but bites us here.
One way to get around the visibility problem is with a modifyPlotProps
function in the higher order component that wraps container nested fields. This has been used a bunch of other times to customize the behaviour of certain fields. To work around the second case we will need to signal to connectToContainer
that it needs to recompute plotProps
.
I am going to move some of the other simple exceptions to a shame.js file and add the layout-inside-trace <Gap>
widgets in there as well. Once I have progressed further it will hopefully become more apparent what exceptions need to be refactored away.
from react-chart-editor.
Also re: shouldComponentUpdate and context
. This is pretty bad overall but if we are clear that any non-Editor intermediary component that is inserted into the graph and wants to implement shouldComponentUpdate
needs to check the Editor.revision number we should be ok. If it increases the component must update. Then whenever we change context we make sure the revision number is always incremented. The rudiments for this are already in place. See #61
from react-chart-editor.
workaround here #91
from react-chart-editor.
closed by #99
from react-chart-editor.
Related Issues (20)
- Legend Group Dropdown doesn't display selected option
- settings for subplot
- Different map tile provider HOT 1
- jupyterlab-chart-editor build issues HOT 4
- Action Required: Fix Renovate Configuration HOT 1
- Incorrect styling for foldable section HOT 3
- React 16 HOT 2
- Enable webgl for scatter by default? HOT 1
- TypeScript declarations HOT 1
- Bar chart with base defined
- Trying to get in touch regarding a security issue HOT 2
- Dependency Dashboard
- [Question] Is there a way to limit the max number of traces? HOT 1
- Translation for Editor HOT 2
- Compiled version of dependency NextJS
- missing translation keys
- LaTeX editor doesn't work
- Can Chart Editor Supports Angular ?
- Editing titles within the plot doesn't call onUpdate HOT 1
- Incomplete translation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-chart-editor.