[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [FIX] chartjs: Prevent fatal js errors with multiple charts on the same page.
"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a870fc63546a_3818cab845618@gitlab-sidekiq-low-urgency-cpu-bound-v2-76457594dd-vkd9c.mail> |
Jonny Bradley pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki Commits: 4c47b9f1 by Jonny Bradley at 2026-08-20T14:24:18+00:00 [FIX] chartjs: Prevent fatal js errors with multiple charts on the same page. --- * [FIX] chartjs: Prevent fatal js errors with multiple charts on the same page. --- * [FIX] chartjs: Prevent fatal js errors with multiple charts on the same page. Reverts most of !5155 (by me) which was needed a couple of years ago, but errors now. See merge request tikiwiki/tiki!11013 (cherry picked from commit f912d7791abc8cb950d6a9a231a4bb69bf8b326a) d85404a2 [FIX] chartjs: Prevent fatal js errors with multiple charts on the same page. Co-authored-by: Jonny Bradley <[email protected]> See merge request tikiwiki/tiki!11018 - - - - - 1 changed file: - lib/wiki-plugins/wikiplugin_chartjs.php Changes: ===================================== lib/wiki-plugins/wikiplugin_chartjs.php ===================================== @@ -164,20 +164,13 @@ function wikiplugin_chartjs($data, $params) $canvas = '<canvas id="' . $params['id'] . '" width="' . $params['width'] . '" height="' . $params['height'] . '"></canvas>'; if (! $to_PDF) { - if ($instance === 1) { - TikiLib::lib('header')->add_js_module( - ' - import { Chart, registerables } from "chartjs"; - Chart.register(...registerables); - setTimeout(function () {' . $script . '}, 500); - ' - ); - } else { - TikiLib::lib('header')->add_js_module(' - setTimeout(function () {' . $script . '}, 500); - '); - } - + TikiLib::lib('header')->add_js_module( + ' + import { Chart, registerables } from "chartjs"; + Chart.register(...registerables); + setTimeout(function () {' . $script . '}, 500); + ' + ); return '<div class="tiki-chartjs">' . $canvas . '</div>'; } View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/4c47b9f17b6e42b9c2bcb46efb3214f7176952a6 -- View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/4c47b9f17b6e42b9c2bcb46efb3214f7176952a6 You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help _______________________________________________ TikiWiki-cvs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs