- Enable SSR for match pages by detecting server vs client context in API client - Fix 500 errors on economy, chat, and details tabs by adding data loaders - Handle unparsed matches gracefully with "Match Not Parsed" messages - Fix dynamic team ID detection instead of hardcoding team IDs 2/3 - Fix DataTable component to properly render HTML in render functions - Add fixed column widths to tables for visual consistency - Add meta titles to all tab page loaders - Fix Svelte 5 $derived syntax errors - Fix ESLint errors (unused imports, any types, reactive state) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
898 B
TypeScript
40 lines
898 B
TypeScript
import { api } from '$lib/api';
|
|
import type { PageLoad } from './$types';
|
|
|
|
export const load: PageLoad = async ({ parent, params }) => {
|
|
const { match } = await parent();
|
|
|
|
// Only load weapons data if match is parsed
|
|
if (!match.demo_parsed) {
|
|
return {
|
|
match,
|
|
weaponsData: null,
|
|
meta: {
|
|
title: `${match.map || 'Match'} Details - Match ${match.match_id} - CS2.WTF`
|
|
}
|
|
};
|
|
}
|
|
|
|
try {
|
|
const weaponsData = await api.matches.getMatchWeapons(params.id);
|
|
|
|
return {
|
|
match,
|
|
weaponsData,
|
|
meta: {
|
|
title: `${match.map || 'Match'} Details - Match ${match.match_id} - CS2.WTF`
|
|
}
|
|
};
|
|
} catch (err) {
|
|
console.error(`Failed to load weapons data for match ${params.id}:`, err);
|
|
// Return null instead of throwing error
|
|
return {
|
|
match,
|
|
weaponsData: null,
|
|
meta: {
|
|
title: `${match.map || 'Match'} Details - Match ${match.match_id} - CS2.WTF`
|
|
}
|
|
};
|
|
}
|
|
};
|