From 102a879a3ab5dc34d7c32d8fa13baf73ad79ed7a Mon Sep 17 00:00:00 2001 From: Ken Johnson Date: Sun, 7 Dec 2025 00:57:54 -0500 Subject: [PATCH] Fix EasyPieChart errors on admin dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed "Cannot read properties of undefined (reading 'update')" errors caused by chart setTimeout callbacks persisting across Turbolinks page navigations. Changes: - Add existence checks before initializing charts - Guard all .update() calls with element and instance checks - Track all setTimeout IDs in chartTimeouts array - Clear timeouts on Turbolinks navigation events - Clear timeouts at start of pieChartHome() to prevent duplicates This ensures chart update callbacks only run when chart elements exist on the page, preventing errors when navigating to pages without charts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/views/dashboard/pie_charts.html.erb | 232 ++++++++++++++++-------- 1 file changed, 154 insertions(+), 78 deletions(-) diff --git a/app/views/dashboard/pie_charts.html.erb b/app/views/dashboard/pie_charts.html.erb index e4059da..eb98bcb 100755 --- a/app/views/dashboard/pie_charts.html.erb +++ b/app/views/dashboard/pie_charts.html.erb @@ -48,8 +48,18 @@ <% end %>