[PR #2201] [MERGED] fix: prevent login form flash in authenticated app shell #8113

Closed
opened 2026-04-20 18:02:46 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2201
Author: @kolaente
Created: 2/6/2026
Status: Merged
Merged: 2/6/2026
Merged by: @kolaente

Base: mainHead: fix-login-form-flash


📝 Commits (7)

  • 58fa8dd fix: redirect immediately after login to prevent form flash in app shell
  • d0c4bd3 fix: redirect immediately after registration to prevent form flash in app shell
  • c957cc3 test: add E2E test for login form flash regression
  • 9b7f65a fix: avoid clearing saved redirect in onBeforeMount to prevent race with submit
  • 25f6383 fix: prevent auth layout swap while still on login/register route
  • 8f26b00 refactor: extract auth route names into shared constant
  • 44fc033 fix: guard against undefined route.name in auth layout check

📊 Changes

6 files changed (+58 additions, -11 deletions)

View changed files

📝 frontend/src/App.vue (+4 -1)
frontend/src/constants/authRouteNames.ts (+13 -0)
📝 frontend/src/router/index.ts (+2 -8)
📝 frontend/src/views/user/Login.vue (+9 -2)
📝 frontend/src/views/user/Register.vue (+3 -0)
📝 frontend/tests/e2e/user/login.spec.ts (+27 -0)

📄 Description

Summary

  • After a successful login or registration, the login form briefly flashed (~250ms) inside the authenticated app shell (navbar + sidebar) before navigating to the home page
  • Root cause: App.vue switches to the authenticated layout via v-if="authStore.authUser" as soon as auth state becomes truthy, but Vue's reactivity flush runs before the await continuation in submit() can navigate away from /login
  • Fix: add a route check in App.vue so the authenticated layout only renders when the current route is not an auth page (login, register, password reset, openid). The NoAuthWrapper stays visible until redirectIfSaved() navigates away, then the authenticated layout renders cleanly
  • Also add redirectIfSaved() calls after successful login/registration in submit() to ensure navigation happens, and fix a race condition in onBeforeMount that could clear the saved redirect URL

Test plan

  • Log in and verify the login form no longer flashes inside the navbar/sidebar shell
  • Register a new user and verify no flash occurs
  • Navigate to a protected route while logged out, log in, and verify redirect back to that route
  • New E2E test Should not show login form inside authenticated app shell after login passes (uses MutationObserver to detect simultaneous presence of login form + navbar)
  • All existing login E2E tests pass

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2201 **Author:** [@kolaente](https://github.com/kolaente) **Created:** 2/6/2026 **Status:** ✅ Merged **Merged:** 2/6/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix-login-form-flash` --- ### 📝 Commits (7) - [`58fa8dd`](https://github.com/go-vikunja/vikunja/commit/58fa8dd1cb63b1014054425bbcc164dedde888ec) fix: redirect immediately after login to prevent form flash in app shell - [`d0c4bd3`](https://github.com/go-vikunja/vikunja/commit/d0c4bd30381ed0400be5391a6b449d721552e3a5) fix: redirect immediately after registration to prevent form flash in app shell - [`c957cc3`](https://github.com/go-vikunja/vikunja/commit/c957cc3d95d86ba1f9ac721a62665b03568d5371) test: add E2E test for login form flash regression - [`9b7f65a`](https://github.com/go-vikunja/vikunja/commit/9b7f65a07c8cb017242b45850d8eb118158b0cf4) fix: avoid clearing saved redirect in onBeforeMount to prevent race with submit - [`25f6383`](https://github.com/go-vikunja/vikunja/commit/25f63835148192db1c953d2341f30e74e9f5f4c2) fix: prevent auth layout swap while still on login/register route - [`8f26b00`](https://github.com/go-vikunja/vikunja/commit/8f26b00e035285938668bbe56596f05b2b824aeb) refactor: extract auth route names into shared constant - [`44fc033`](https://github.com/go-vikunja/vikunja/commit/44fc033444893a535b3b28ccb5f6e05d059409e1) fix: guard against undefined route.name in auth layout check ### 📊 Changes **6 files changed** (+58 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/App.vue` (+4 -1) ➕ `frontend/src/constants/authRouteNames.ts` (+13 -0) 📝 `frontend/src/router/index.ts` (+2 -8) 📝 `frontend/src/views/user/Login.vue` (+9 -2) 📝 `frontend/src/views/user/Register.vue` (+3 -0) 📝 `frontend/tests/e2e/user/login.spec.ts` (+27 -0) </details> ### 📄 Description ## Summary - After a successful login or registration, the login form briefly flashed (~250ms) inside the authenticated app shell (navbar + sidebar) before navigating to the home page - Root cause: `App.vue` switches to the authenticated layout via `v-if="authStore.authUser"` as soon as auth state becomes truthy, but Vue's reactivity flush runs before the `await` continuation in `submit()` can navigate away from `/login` - Fix: add a route check in `App.vue` so the authenticated layout only renders when the current route is not an auth page (login, register, password reset, openid). The `NoAuthWrapper` stays visible until `redirectIfSaved()` navigates away, then the authenticated layout renders cleanly - Also add `redirectIfSaved()` calls after successful login/registration in `submit()` to ensure navigation happens, and fix a race condition in `onBeforeMount` that could clear the saved redirect URL ## Test plan - [ ] Log in and verify the login form no longer flashes inside the navbar/sidebar shell - [ ] Register a new user and verify no flash occurs - [ ] Navigate to a protected route while logged out, log in, and verify redirect back to that route - [ ] New E2E test `Should not show login form inside authenticated app shell after login` passes (uses MutationObserver to detect simultaneous presence of login form + navbar) - [ ] All existing login E2E tests pass --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 18:02:46 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#8113