Read safely from plotly-json properties to avoid crash on existing charts (#2193)

This commit is contained in:
Sherfin Shamsudeen 2022-02-08 08:21:48 +05:30 committed by GitHub
parent a38ebb764c
commit 46ef41fb0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,7 +63,7 @@ class Chart extends React.Component {
const jsonDescription = this.state.component.component.definition.properties.jsonDescription;
const plotFromJson = resolveReferences(
this.state.component.component.definition.properties.plotFromJson.value,
this.state.component.component.definition.properties.plotFromJson?.value,
currentState
);
@ -105,7 +105,7 @@ class Chart extends React.Component {
children: (
<CodeHinter
currentState={this.props.currentState}
initialValue={jsonDescription.value}
initialValue={jsonDescription?.value ?? {}}
theme={this.props.darkMode ? 'monokai' : 'duotone-light'}
mode="javascript"
lineNumbers={false}