Bogus TypeError when updating box plot series with a different number of data points
<VueApexCharts :series="series" type="boxPlot" />
When series changes I get a TypeError if the length of series[0].data has changed
apexcharts.common.js:14 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'resetSeries')
at Proxy.value (apexcharts.common.js:14:41711)
at Object.deep (vue3-apexcharts.common.js:465:23)
at callWithErrorHandling (runtime-core.esm-bundler.js:173:22)
at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:182:21)
at job (runtime-core.esm-bundler.js:1812:17)
at flushPreFlushCbs (runtime-core.esm-bundler.js:336:13)
at updateComponentPreRender (runtime-core.esm-bundler.js:5789:9)
at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5702:21)
at ReactiveEffect.run (reactivity.esm-bundler.js:190:25)
at instance.update (runtime-core.esm-bundler.js:5763:56)
(that was Chrome; in Firefox the error message is TypeError: this.series is null)
apexcharts.common.js:
}, {
key: "updateSeries",
value: function() {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []
, e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1]
, i = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2];
return this.series.resetSeries(!1), // <----------------
However if I catch the error like this:
<script>
export default {
errorCaptured (err, instance, info) {
if (err.message.includes('resetSeries')) {
return false
}
},
...
Everything works just fine.
For some reason I can't reproduce this in Vue SFC Playground
Version
apexcharts: 3.41.0
vue3-apexcharts: 1.4.1
Hitting a similar problem when both series and type change one after the other
I think the chart engine choke itself if it's still dealing with the previous change and a new update comes in
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Still present on
apexcharts: 3.54.0
vue3-apexcharts: 1.7.0
but it's worse now as using errorCaptured doesn't prevent the chart from breaking
I've done some debugging and found that https://github.com/apexcharts/vue3-apexcharts/pull/50 (v1.4.4) introduced this bug.
Edit: further debugging, found out it only affects the chart if the height is set to scale with the number of entries in the series.
- First time you remove an entry from the series, the whole chart disappears.
- Second time, you get the TypeError
@junedchhipa Think this fixes it: https://github.com/apexcharts/vue3-apexcharts/pull/123