From 8abf4090412146a429eb1ced1305b64ba9cd70bd Mon Sep 17 00:00:00 2001 From: Ken Johnson Date: Sun, 7 Dec 2025 02:31:36 -0500 Subject: [PATCH] Fix Google Charts loading for AJAX-loaded bar graph MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The issue was that google.load() doesn't work reliably when called from AJAX-loaded content. The callback wasn't firing. Solution: - Load Google Charts library once in main application.html.erb layout - Bar graph partial now just polls for google.visualization to be ready - Uses retry logic (50 attempts @ 100ms = 5 second timeout) - Returns success/failure boolean for proper flow control - Removed duplicate script loading from partial This ensures Google Charts is available globally for all chart views (bar graphs, pie charts, performance charts) without timing issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/views/dashboard/bar_graph.html.erb | 58 ++++++++++++------------- app/views/layouts/application.html.erb | 9 ++++ db/development.sqlite3-shm | Bin 32768 -> 32768 bytes db/development.sqlite3-wal | Bin 41232 -> 8272 bytes 4 files changed, 37 insertions(+), 30 deletions(-) diff --git a/app/views/dashboard/bar_graph.html.erb b/app/views/dashboard/bar_graph.html.erb index 8c8041c..6da5204 100644 --- a/app/views/dashboard/bar_graph.html.erb +++ b/app/views/dashboard/bar_graph.html.erb @@ -1,25 +1,17 @@
- - - diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b59bbd0..0dbf858 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -29,6 +29,15 @@ + + + +