Refactor router navigation handling: Update beforeEach hook in router.js to prevent incorrect route matching on initial load. Ensure proper path normalization and query handling to enhance navigation reliability.
All checks were successful
Deploy miriamgemeinde / deploy (push) Successful in 6s

This commit is contained in:
Torsten Schulz (local)
2026-04-29 18:58:50 +02:00
parent 654ca22439
commit 1182426cda

View File

@@ -156,7 +156,10 @@ router.beforeEach(async (to, from, next) => {
next({ path: normalizedToPath, query: to.query, hash: to.hash, replace: true });
return;
}
next({ ...to, replace: true });
// Wichtig: nicht `...to` übernehmen, da `to` beim Initial-Load ggf. bereits
// auf der Catch-All-Route gematcht wurde. Dann würde der NotFound-Match
// trotz inzwischen geladener Menüroute "kleben" bleiben.
next({ path: normalizedToPath, query: to.query, hash: to.hash, replace: true });
} else {
// Sicherstellen, dass Kernrouten immer verfügbar sind
ensureCoreRoutes();