From 7a5cd404e0841a150aac8e815cf4afb6ad1b2e27 Mon Sep 17 00:00:00 2001 From: Wil Gieseler Date: Tue, 1 Aug 2023 00:43:12 -0700 Subject: [PATCH] Fix for Turbo [Closes https://github.com/ankane/chartkick/issues/608] --- lib/chartkick/helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/chartkick/helper.rb b/lib/chartkick/helper.rb index fb7a25d..61934ca 100644 --- a/lib/chartkick/helper.rb +++ b/lib/chartkick/helper.rb @@ -119,6 +119,7 @@ def chartkick_chart(klass, data_source, **options) var createChart = function() { #{createjs} }; if ("Chartkick" in window) { createChart(); + window.addEventListener("turbo:load", createChart, {once: true}); } else { window.addEventListener("chartkick:load", createChart, true); }