From f37d02b591d1cb17340af3d60ef32183ce16c1a2 Mon Sep 17 00:00:00 2001 From: mutantsan Date: Tue, 18 Jun 2024 11:30:53 +0300 Subject: [PATCH] reinit js smarter, to prevent doing it multiple times --- ckanext/charts/assets/js/charts-global.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ckanext/charts/assets/js/charts-global.js b/ckanext/charts/assets/js/charts-global.js index 288d6ef..8c17ad2 100644 --- a/ckanext/charts/assets/js/charts-global.js +++ b/ckanext/charts/assets/js/charts-global.js @@ -14,7 +14,12 @@ ckan.module("charts-global", function ($, _) { var elements = event.target.querySelectorAll("[data-module]"); for (let node of elements) { + if (node.getAttribute("dm-initialized")) { + continue; + } + ckan.module.initializeElement(node); + node.setAttribute("dm-initialized", true) } }); }