Skip to content

Commit

Permalink
Guard navigation to home during App:mount
Browse files Browse the repository at this point in the history
We need to check if the current route is `booting` on reload or startup,
else a reload or forward navigation doesn't work since we always try to
navigate users to `home` instead of the desired route.
  • Loading branch information
sebastinez committed Sep 5, 2024
1 parent ccfb54c commit ba6e407
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
onMount(async () => {
try {
await invoke("authenticate");
void router.push({ resource: "home" });
if ($activeRouteStore.resource === "booting") {
void router.push({ resource: "home" });
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (e: any) {
void router.push({
Expand Down

0 comments on commit ba6e407

Please sign in to comment.