From 5986379d94e82f24d4acd339e00086e511d430e3 Mon Sep 17 00:00:00 2001 From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Sun, 19 Jul 2026 15:37:30 +0200 Subject: [PATCH] Remove route argument --- app/assets/javascripts/router.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/router.js b/app/assets/javascripts/router.js index 058835fda..5e579c90c 100644 --- a/app/assets/javascripts/router.js +++ b/app/assets/javascripts/router.js @@ -113,7 +113,8 @@ OSM.Router = function (map, rts) { }); } - function transition(path, route, beforeEnter = () => {}) { + function transition(path, beforeEnter = () => {}) { + const route = routes.recognize(path); if (!route) return false; routingInProgress = routingInProgress .catch(() => {}) @@ -130,18 +131,16 @@ OSM.Router = function (map, rts) { $(window).on("popstate", function (e) { if (!e.originalEvent.state) return; // Is it a real popstate event or just a hash change? - const path = location.pathname + location.search, - route = routes.recognize(path); + const path = location.pathname + location.search; if (path === currentPath) return; - const done = transition(path, route); + const done = transition(path); if (done) done.then(() => map.setState(e.originalEvent.state, { animate: false })); }); router.route = function (url) { - const path = url.replace(/#.*/, ""), - route = routes.recognize(path); + const path = url.replace(/#.*/, ""); const state = OSM.parseHash(url); - return Boolean(transition(path, route, () => { + return Boolean(transition(path, () => { map.setState(state); window.history.pushState(state, document.title, url); })); -- 2.47.3