Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions app/views/assistants/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@
const ctx = document.getElementById('chatsPerDayChart');
if (!ctx) return;

// Check if Chart.js is loaded, if not wait for it
if (typeof Chart === 'undefined') {
// Wait for Chart.js to load
const checkChart = setInterval(() => {
if (typeof Chart !== 'undefined') {
clearInterval(checkChart);
createChart(ctx);
}
}, 100);
return;
}

createChart(ctx);
}

function createChart(ctx) {
// Destroy existing chart if it exists to prevent duplicates
if (window.chatsChart) {
window.chatsChart.destroy();
Expand Down