From 412795261cc8833da7178696fd2f0455b070b9e0 Mon Sep 17 00:00:00 2001 From: Anjo Vahldiek Date: Wed, 15 Jul 2026 11:15:43 +0200 Subject: [PATCH] fix(profile): dispose stale ECharts instance in initEChart echarts.init reuses an existing instance on a DOM node, and setOption merges by default, so switching profiles left a previous person's Contributions Over Time series (e.g. AE Committee Service / ArtiFinder) rendered for the next person. Dispose any pre-existing instance before re-init so every render starts from a clean slate. --- src/assets/js/reprodb-utils.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/assets/js/reprodb-utils.js b/src/assets/js/reprodb-utils.js index 0fed779a..09140aa6 100644 --- a/src/assets/js/reprodb-utils.js +++ b/src/assets/js/reprodb-utils.js @@ -96,6 +96,13 @@ R.initEChart = function(el) { if (typeof el === 'string') el = document.getElementById(el); if (!el) return null; + // Dispose any existing instance on this element so re-renders start from + // a clean slate. echarts.init otherwise returns the existing instance, and + // a subsequent setOption() merges by default — leaving stale series/data + // (e.g. a previous profile's "AE Committee Service" bars) behind when + // switching between people on the profile page. + var existing = echarts.getInstanceByDom(el); + if (existing) existing.dispose(); var chart = echarts.init(el, null, { renderer: 'canvas' }); // Wrap setOption so every call automatically re-applies theme text