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
5301c48e03
commit
6265531719
3 changed files with 30 additions and 2 deletions
|
|
@ -4745,6 +4745,20 @@
|
|||
"file": "/home/theflow/projects/tractatus/public/architecture.html",
|
||||
"result": "passed",
|
||||
"reason": null
|
||||
},
|
||||
{
|
||||
"hook": "validate-file-edit",
|
||||
"timestamp": "2025-10-19T09:20:19.070Z",
|
||||
"file": "/home/theflow/projects/tractatus/public/js/components/pressure-chart.js",
|
||||
"result": "passed",
|
||||
"reason": null
|
||||
},
|
||||
{
|
||||
"hook": "validate-file-edit",
|
||||
"timestamp": "2025-10-19T09:20:27.893Z",
|
||||
"file": "/home/theflow/projects/tractatus/public/js/components/activity-timeline.js",
|
||||
"result": "passed",
|
||||
"reason": null
|
||||
}
|
||||
],
|
||||
"blocks": [
|
||||
|
|
@ -5008,9 +5022,9 @@
|
|||
}
|
||||
],
|
||||
"session_stats": {
|
||||
"total_edit_hooks": 488,
|
||||
"total_edit_hooks": 490,
|
||||
"total_edit_blocks": 36,
|
||||
"last_updated": "2025-10-19T09:16:31.732Z",
|
||||
"last_updated": "2025-10-19T09:20:27.893Z",
|
||||
"total_write_hooks": 190,
|
||||
"total_write_blocks": 7
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,16 +123,23 @@ class ActivityTimeline {
|
|||
// Auto-initialize if container exists
|
||||
if (typeof window !== 'undefined') {
|
||||
function initActivityTimeline() {
|
||||
console.log('[ActivityTimeline] Attempting to initialize, readyState:', document.readyState);
|
||||
const container = document.getElementById('activity-timeline');
|
||||
if (container) {
|
||||
console.log('[ActivityTimeline] Container found, creating instance');
|
||||
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
|
||||
console.log('[ActivityTimeline] Script loaded, readyState:', document.readyState);
|
||||
if (document.readyState === 'loading') {
|
||||
console.log('[ActivityTimeline] Waiting for DOMContentLoaded');
|
||||
document.addEventListener('DOMContentLoaded', initActivityTimeline);
|
||||
} else {
|
||||
console.log('[ActivityTimeline] DOM already loaded, initializing immediately');
|
||||
initActivityTimeline();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,16 +212,23 @@ class PressureChart {
|
|||
// Auto-initialize if container exists
|
||||
if (typeof window !== 'undefined') {
|
||||
function initPressureChart() {
|
||||
console.log('[PressureChart] Attempting to initialize, readyState:', document.readyState);
|
||||
const container = document.getElementById('pressure-chart');
|
||||
if (container) {
|
||||
console.log('[PressureChart] Container found, creating instance');
|
||||
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
|
||||
console.log('[PressureChart] Script loaded, readyState:', document.readyState);
|
||||
if (document.readyState === 'loading') {
|
||||
console.log('[PressureChart] Waiting for DOMContentLoaded');
|
||||
document.addEventListener('DOMContentLoaded', initPressureChart);
|
||||
} else {
|
||||
console.log('[PressureChart] DOM already loaded, initializing immediately');
|
||||
initPressureChart();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue