Skip to content

Commit 3b46bc8

Browse files
authored
Merge pull request #291 from apertureless/feature/fix_reactive_mixins
fix(mixins): Check for chartjs instance before rendering chart
2 parents 0506b4e + 39ff839 commit 3b46bc8

File tree

3 files changed

+552
-484
lines changed

3 files changed

+552
-484
lines changed

src/mixins/reactiveData.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ module.exports = {
6363
this.renderChart(this.chartData, this.options)
6464
}
6565
} else {
66+
if (this.$data._chart) {
67+
this.$data._chart.destroy()
68+
}
6669
this.renderChart(this.chartData, this.options)
6770
}
6871
}

src/mixins/reactiveProp.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ module.exports = {
6363
this.renderChart(this.chartData, this.options)
6464
}
6565
} else {
66+
if (this.$data._chart) {
67+
this.$data._chart.destroy()
68+
}
6669
this.renderChart(this.chartData, this.options)
6770
}
6871
}

0 commit comments

Comments
 (0)