fix: prevent auth layout swap while still on login/register route

The v-if in App.vue switches to the authenticated layout (navbar +
sidebar) as soon as authStore.authUser becomes truthy. But Vue's
reactivity flush runs before the await continuation in submit(), so
the layout swaps while the route is still /login, causing the login
form to flash inside the authenticated shell for ~250ms.

Fix by adding a route check: don't show the authenticated layout while
the current route is an auth page (login, register, password reset,
openid). The NoAuthWrapper stays visible until redirectIfSaved()
navigates away, then the authenticated layout renders cleanly.
This commit is contained in:
kolaente
2026-02-06 10:38:41 +01:00
parent 0e2ea5c42a
commit 5d9f62cc93

View File

@@ -1,6 +1,6 @@
<template>
<Ready>
<template v-if="authStore.authUser">
<template v-if="showAuthLayout">
<AppHeader />
<ContentAuth />
</template>
@@ -57,6 +57,15 @@ const baseStore = useBaseStore()
const route = useRoute()
const AUTH_ROUTE_NAMES = new Set([
'user.login',
'user.register',
'user.password-reset.request',
'user.password-reset.reset',
'openid.auth',
])
const showAuthLayout = computed(() => authStore.authUser && !AUTH_ROUTE_NAMES.has(route.name as string))
useBodyClass('is-touch', isTouchDevice())
const keyboardShortcutsActive = computed(() => baseStore.keyboardShortcutsActive)