From adceef95876cd345317234683d9f6fe496e2eb50 Mon Sep 17 00:00:00 2001 From: Josh Kelley Date: Thu, 16 Sep 2021 15:43:39 -0400 Subject: [PATCH] Fix cleaning up metasets I believe it's a mistake to only delete the metaset if it has a valid controller; see f191f2f5 for where this behavior was introduced. This is a minimal fix for #9653; as discussed there, it may also be worth updating `updateHoverStyle`. As of #7030, `this._metasets` should always be defined, so checking whether it's undefined is no longer necessary. --- src/core/core.controller.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/core.controller.js b/src/core/core.controller.js index c5b77a0f989..bf23252780f 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -800,12 +800,11 @@ class Chart { * @private */ _destroyDatasetMeta(datasetIndex) { - const meta = this._metasets && this._metasets[datasetIndex]; - + const meta = this._metasets[datasetIndex]; if (meta && meta.controller) { meta.controller._destroy(); - delete this._metasets[datasetIndex]; } + delete this._metasets[datasetIndex]; } _stop() {