Merge pull request #49 from appsmithorg/release

Release
This commit is contained in:
Nikhil Nandagopal 2020-09-16 13:42:34 +05:30 committed by GitHub
commit 82ce5a1c2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,11 +139,6 @@ function DataControlComponent(props: RenderComponentProps) {
} }
class ChartDataControl extends BaseControl<ControlProps> { class ChartDataControl extends BaseControl<ControlProps> {
chartData: Array<{
seriesName: string;
data: string;
}> = [];
getValidations = (message: string, isValid: boolean, len: number) => { getValidations = (message: string, isValid: boolean, len: number) => {
const validations: Array<{ const validations: Array<{
isValid: boolean; isValid: boolean;
@ -173,7 +168,10 @@ class ChartDataControl extends BaseControl<ControlProps> {
}; };
componentDidMount() { componentDidMount() {
const chartData = this.props.propertyValue; this.migrateChartData(this.props.propertyValue);
}
migrateChartData(chartData: Array<{ seriesName: string; data: string }>) {
// Added a migration script for older chart data that was strings // Added a migration script for older chart data that was strings
// deprecate after enough charts have moved to the new format // deprecate after enough charts have moved to the new format
if (_.isString(chartData)) { if (_.isString(chartData)) {
@ -182,8 +180,8 @@ class ChartDataControl extends BaseControl<ControlProps> {
seriesName: string; seriesName: string;
data: string; data: string;
}> = JSON.parse(chartData); }> = JSON.parse(chartData);
this.updateProperty("chartData", parsedData); this.updateProperty(this.props.propertyName, parsedData);
this.chartData = parsedData; return parsedData;
} catch (error) { } catch (error) {
Sentry.captureException({ Sentry.captureException({
message: "Chart Migration Failed", message: "Chart Migration Failed",
@ -191,17 +189,17 @@ class ChartDataControl extends BaseControl<ControlProps> {
}); });
} }
} else { } else {
this.chartData = this.props.propertyValue; return this.props.propertyValue;
} }
} }
componentDidUpdate() {
this.chartData = this.props.propertyValue;
}
render() { render() {
const chartData = this.chartData; const chartData: Array<{ seriesName: string; data: string }> = _.isString(
const dataLength = this.chartData.length; this.props.propertyValue,
)
? []
: this.props.propertyValue;
const dataLength = chartData.length;
const { validationMessage, isValid } = this.props; const { validationMessage, isValid } = this.props;
const validations: Array<{ const validations: Array<{
isValid: boolean; isValid: boolean;
@ -213,7 +211,7 @@ class ChartDataControl extends BaseControl<ControlProps> {
); );
return ( return (
<React.Fragment> <React.Fragment>
{this.chartData.map((data, index) => { {chartData.map((data, index) => {
return ( return (
<DataControlComponent <DataControlComponent
key={index} key={index}