From 1182426cdadf1b001384dbe19a5b80d97eb58ce1 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Wed, 29 Apr 2026 18:58:50 +0200 Subject: [PATCH] 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. --- src/router.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/router.js b/src/router.js index ea51d1a..e8bd1e6 100644 --- a/src/router.js +++ b/src/router.js @@ -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();