![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.ca/public_html/scripts/ |
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
console.log('š§ Testing Fixes for Runtime Errors and Navigation Issues\n');
// Test 1: Check if DashboardModal.tsx is properly formatted
console.log('1. Checking DashboardModal.tsx file integrity...');
try {
const dashboardModalPath = path.join(__dirname, '..', 'src', 'components', 'DashboardModal.tsx');
const content = fs.readFileSync(dashboardModalPath, 'utf8');
if (content.includes('Download the React DevTools')) {
console.log('ā DashboardModal.tsx still contains browser console output');
} else if (content.includes('import React')) {
console.log('ā
DashboardModal.tsx is properly formatted');
} else {
console.log('ā DashboardModal.tsx appears to be corrupted');
}
} catch (error) {
console.log('ā Error reading DashboardModal.tsx:', error.message);
}
// Test 2: Check if hard navigation issue is fixed
console.log('\n2. Checking for hard navigation issues...');
try {
const caseDetailPath = path.join(__dirname, '..', 'src', 'components', 'CaseDetail.tsx');
const content = fs.readFileSync(caseDetailPath, 'utf8');
if (content.includes('window.location.href = \'/\'')) {
console.log('ā Hard navigation still present in CaseDetail.tsx');
} else if (content.includes('window.history.pushState')) {
console.log('ā
Hard navigation replaced with history API');
} else {
console.log('ā ļø Navigation method not found in CaseDetail.tsx');
}
} catch (error) {
console.log('ā Error reading CaseDetail.tsx:', error.message);
}
// Test 3: Check if .next directory exists and has proper structure
console.log('\n3. Checking Next.js build cache...');
try {
const nextDir = path.join(__dirname, '..', '.next');
if (fs.existsSync(nextDir)) {
const files = fs.readdirSync(nextDir);
if (files.length > 0) {
console.log('ā
.next directory exists and has content');
} else {
console.log('ā ļø .next directory exists but is empty');
}
} else {
console.log('ā ļø .next directory does not exist (will be created on first build)');
}
} catch (error) {
console.log('ā Error checking .next directory:', error.message);
}
// Test 4: Check for syntax errors in key files
console.log('\n4. Checking for syntax errors...');
const filesToCheck = [
'src/components/DashboardModal.tsx',
'src/components/CaseDetail.tsx',
'src/pages/public/cases/[id].tsx'
];
filesToCheck.forEach(file => {
try {
const filePath = path.join(__dirname, '..', file);
if (fs.existsSync(filePath)) {
const content = fs.readFileSync(filePath, 'utf8');
// Basic syntax check - look for common issues
if (content.includes('import React') && content.includes('export default')) {
console.log(`ā
${file} appears to have valid syntax`);
} else {
console.log(`ā ļø ${file} may have syntax issues`);
}
} else {
console.log(`ā ${file} not found`);
}
} catch (error) {
console.log(`ā Error checking ${file}:`, error.message);
}
});
// Test 5: Check if development server is accessible
console.log('\n5. Checking development server...');
try {
const response = execSync('curl -s -o /dev/null -w "%{http_code}" http://localhost:3000', { encoding: 'utf8' });
if (response.trim() === '200') {
console.log('ā
Development server is responding');
} else {
console.log(`ā ļø Development server returned status: ${response.trim()}`);
}
} catch (error) {
console.log('ā Development server not accessible or curl not available');
}
console.log('\nšÆ Summary of Fixes Applied:');
console.log('1. ā
Recreated DashboardModal.tsx (was corrupted with browser console output)');
console.log('2. ā
Fixed hard navigation in CaseDetail.tsx (replaced window.location.href with history API)');
console.log('3. ā
Cleared Next.js build cache (.next directory)');
console.log('4. ā
Restarted development server');
console.log('\nš Next Steps:');
console.log('1. Navigate to https://localhost:3443/public/cases/[case-id]');
console.log('2. Test the live chat functionality');
console.log('3. Verify that navigation works without hard navigation errors');
console.log('4. Check that modals open properly without corruption');
console.log('\n⨠All fixes have been applied! The runtime errors should now be resolved.');