fix: make page navigation not kill css
All checks were successful
deploy to cloudflare pages / deploy (push) Successful in 34s
All checks were successful
deploy to cloudflare pages / deploy (push) Successful in 34s
This commit is contained in:
parent
ef25e178bf
commit
e986e23767
1 changed files with 7 additions and 2 deletions
|
@ -25,7 +25,12 @@
|
|||
let solutionLine: L.Polyline | null = $state(null);
|
||||
|
||||
onMount(() => {
|
||||
window.addEventListener("beforeunload", (e) => e.preventDefault());
|
||||
window.addEventListener("beforeunload", async (e) => {
|
||||
const gameData = await gamePromise;
|
||||
if (gameData.stopNames.length > currentIndex + 1) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
async function fetchMap(): Promise<MapData> {
|
||||
|
@ -124,7 +129,7 @@
|
|||
results = null;
|
||||
|
||||
if (gameData.stopNames.length <= currentIndex + 1) {
|
||||
goto("/results?" + new URLSearchParams({ gameId: gameData.gameId }));
|
||||
window.location.href = "/results?" + new URLSearchParams({ gameId: gameData.gameId });
|
||||
} else {
|
||||
currentIndex++;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue