From 33b0f8fb7474b2c25a7cf9c5b8daa72e177b0d6e Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 18 Jul 2022 12:26:23 +0200 Subject: [PATCH] stopping navigation in certain cases if test is restarting, result calculating or page already transitioning closes #3341 --- frontend/src/ts/controllers/route-controller.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/src/ts/controllers/route-controller.ts b/frontend/src/ts/controllers/route-controller.ts index cb3d63888..7838bb937 100644 --- a/frontend/src/ts/controllers/route-controller.ts +++ b/frontend/src/ts/controllers/route-controller.ts @@ -7,6 +7,8 @@ import * as PageLogin from "../pages/login"; import * as Page404 from "../pages/404"; import * as PageProfile from "../pages/profile"; import * as Leaderboards from "../elements/leaderboards"; +import * as TestUI from "../test/test-ui"; +import * as PageTransition from "../states/page-transition"; // import * as ActivePage from "../states/active-page"; import { Auth } from "../firebase"; @@ -100,6 +102,13 @@ const routes: Route[] = [ ]; export function navigate(url = window.location.pathname): void { + if ( + TestUI.testRestarting || + TestUI.resultCalculating || + PageTransition.get() + ) { + return; + } url = url.replace(/\/$/, ""); if (url === "") url = "/"; history.pushState(null, "", url);