mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-07 03:19:13 +08:00
stopping navigation in certain cases
if test is restarting, result calculating or page already transitioning closes #3341
This commit is contained in:
parent
402b37d5a1
commit
33b0f8fb74
1 changed files with 9 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue