From 3fdb9f79bd7e1106e8d3a005a6d55f385c18272a Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Mon, 28 Sep 2020 10:37:53 +0200 Subject: [PATCH] Fixed routes forcing a page refresh on navigation --- app/Routes/Routes.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Routes/Routes.js b/app/Routes/Routes.js index b6803480..bdd7913c 100644 --- a/app/Routes/Routes.js +++ b/app/Routes/Routes.js @@ -13,6 +13,17 @@ Router.plugin("ensureSignedIn", { ] }); +if (Meteor.isClient){ + document.addEventListener(`click`, e => { + const origin = e.target.closest("a"); + + if (origin && Router.findFirstRoute(origin.href)) { + Router.go(origin.href); + e.preventDefault(); + } +}); +} + Router.plugin("dataNotFound", {notFoundTemplate: "notFound"}); var handleSubError = function(e){