debug(demos): add console logging to diagnose initialization issues
SUMMARY: Added detailed console logging to pressure chart and activity timeline components to help diagnose why demos aren't working on production. CHANGES: 1. pressure-chart.js: - Log when script loads and document.readyState - Log whether waiting for DOMContentLoaded or initializing immediately - Log when container is found or not found - Log when instance is created 2. activity-timeline.js: - Same logging pattern as pressure-chart.js DEBUGGING: User reports demos not working. Logs will show: - If scripts are loading - If DOM is ready when scripts execute - If containers are being found - If instances are being created Console output will help identify the failure point. 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
34e435759d
commit
4b9da2d285
2 changed files with 14 additions and 0 deletions
|
|
@ -123,16 +123,23 @@ class ActivityTimeline {
|
||||||
// Auto-initialize if container exists
|
// Auto-initialize if container exists
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
function initActivityTimeline() {
|
function initActivityTimeline() {
|
||||||
|
console.log('[ActivityTimeline] Attempting to initialize, readyState:', document.readyState);
|
||||||
const container = document.getElementById('activity-timeline');
|
const container = document.getElementById('activity-timeline');
|
||||||
if (container) {
|
if (container) {
|
||||||
|
console.log('[ActivityTimeline] Container found, creating instance');
|
||||||
window.activityTimeline = new ActivityTimeline('activity-timeline');
|
window.activityTimeline = new ActivityTimeline('activity-timeline');
|
||||||
|
} else {
|
||||||
|
console.error('[ActivityTimeline] Container #activity-timeline not found in DOM');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize immediately if DOM is already loaded, otherwise wait for DOMContentLoaded
|
// Initialize immediately if DOM is already loaded, otherwise wait for DOMContentLoaded
|
||||||
|
console.log('[ActivityTimeline] Script loaded, readyState:', document.readyState);
|
||||||
if (document.readyState === 'loading') {
|
if (document.readyState === 'loading') {
|
||||||
|
console.log('[ActivityTimeline] Waiting for DOMContentLoaded');
|
||||||
document.addEventListener('DOMContentLoaded', initActivityTimeline);
|
document.addEventListener('DOMContentLoaded', initActivityTimeline);
|
||||||
} else {
|
} else {
|
||||||
|
console.log('[ActivityTimeline] DOM already loaded, initializing immediately');
|
||||||
initActivityTimeline();
|
initActivityTimeline();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -212,16 +212,23 @@ class PressureChart {
|
||||||
// Auto-initialize if container exists
|
// Auto-initialize if container exists
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
function initPressureChart() {
|
function initPressureChart() {
|
||||||
|
console.log('[PressureChart] Attempting to initialize, readyState:', document.readyState);
|
||||||
const container = document.getElementById('pressure-chart');
|
const container = document.getElementById('pressure-chart');
|
||||||
if (container) {
|
if (container) {
|
||||||
|
console.log('[PressureChart] Container found, creating instance');
|
||||||
window.pressureChart = new PressureChart('pressure-chart');
|
window.pressureChart = new PressureChart('pressure-chart');
|
||||||
|
} else {
|
||||||
|
console.error('[PressureChart] Container #pressure-chart not found in DOM');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize immediately if DOM is already loaded, otherwise wait for DOMContentLoaded
|
// Initialize immediately if DOM is already loaded, otherwise wait for DOMContentLoaded
|
||||||
|
console.log('[PressureChart] Script loaded, readyState:', document.readyState);
|
||||||
if (document.readyState === 'loading') {
|
if (document.readyState === 'loading') {
|
||||||
|
console.log('[PressureChart] Waiting for DOMContentLoaded');
|
||||||
document.addEventListener('DOMContentLoaded', initPressureChart);
|
document.addEventListener('DOMContentLoaded', initPressureChart);
|
||||||
} else {
|
} else {
|
||||||
|
console.log('[PressureChart] DOM already loaded, initializing immediately');
|
||||||
initPressureChart();
|
initPressureChart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue