From 22a5f4a1996ee9fb4455f381b89885cc5f432b66 Mon Sep 17 00:00:00 2001 From: "v.terekhov" Date: Fri, 22 Apr 2022 14:02:02 +0400 Subject: [PATCH] fix(legacy-charts): tune chartoptions type check --- legacy/src/Charts.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/legacy/src/Charts.js b/legacy/src/Charts.js index c24fd296..de6d71f2 100644 --- a/legacy/src/Charts.js +++ b/legacy/src/Charts.js @@ -73,12 +73,10 @@ export function generateChart(chartId, chartType, chartController) { }, computed: { hasAnnotationPlugin() { - return ( - Object.keys(this.chartOptions).length > 0 && - 'plugins' in this.chartOptions && - Object.keys(this.chartOptions.plugins).length > 0 && - ANNOTATION_PLUGIN_KEY in this.chartOptions.plugins - ) + const pluginSettings = + this.chartOptions?.plugins?.[ANNOTATION_PLUGIN_KEY] + + return typeof pluginSettings !== 'undefined' } }, created() {