bug fix
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 59s

This commit is contained in:
Tudor
2026-01-08 23:48:56 +00:00
parent 3f8e1911aa
commit 6623418dbe

View File

@@ -224,7 +224,13 @@ function navigateTo(path) {
} }
function handleRoute() { function handleRoute() {
const path = window.location.pathname; let path = window.location.pathname;
// Normalize path - treat /index.html, empty, or just "/" as home
if (path === "" || path === "/index.html" || path.endsWith("/index.html")) {
path = "/";
}
const view = routes[path] || "home"; const view = routes[path] || "home";
// Update page title for SEO // Update page title for SEO
@@ -252,6 +258,7 @@ function handleRoute() {
document.addEventListener("DOMContentLoaded", init); document.addEventListener("DOMContentLoaded", init);
async function init() { async function init() {
try {
// Load filters and metrics in parallel (single request for filters) // Load filters and metrics in parallel (single request for filters)
const [filtersData, metricsData] = await Promise.all([ const [filtersData, metricsData] = await Promise.all([
fetchAPI("/api/filters", { showLoading: "filters" }), fetchAPI("/api/filters", { showLoading: "filters" }),
@@ -272,7 +279,11 @@ async function init() {
// Load initial data // Load initial data
await loadSchools(); await loadSchools();
await loadRankings(); await loadRankings();
} catch (err) {
console.error("Error during initialization:", err);
}
// Always set up event listeners and routing, even if data loading fails
setupEventListeners(); setupEventListeners();
// Handle initial route // Handle initial route