fix: prevent page flickering on redirection based on auth state

This commit is contained in:
Elias Schneider
2025-10-24 11:08:31 +02:00
parent 47927d1574
commit 10d640385f
3 changed files with 10 additions and 10 deletions

View File

@@ -1,12 +1,9 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { page } from '$app/state';
import ConfirmDialog from '$lib/components/confirm-dialog/confirm-dialog.svelte';
import Error from '$lib/components/error.svelte';
import Header from '$lib/components/header/header.svelte';
import { Toaster } from '$lib/components/ui/sonner';
import { m } from '$lib/paraglide/messages';
import { getAuthRedirectPath } from '$lib/utils/redirection-util';
import { ModeWatcher } from 'mode-watcher';
import type { Snippet } from 'svelte';
import '../app.css';
@@ -20,12 +17,7 @@
children: Snippet;
} = $props();
const { user, appConfig } = data;
const redirectPath = getAuthRedirectPath(page.url.pathname, user);
if (redirectPath) {
goto(redirectPath);
}
const { appConfig } = data;
</script>
{#if !appConfig}