Skip to content

Remove landing page#8

Merged
niklhut merged 11 commits intomainfrom
feat/remove-landing-page
Apr 4, 2026
Merged

Remove landing page#8
niklhut merged 11 commits intomainfrom
feat/remove-landing-page

Conversation

@niklhut
Copy link
Copy Markdown
Owner

@niklhut niklhut commented Feb 22, 2026

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved sign-out reliability with enhanced error handling and consistent navigation to login
    • Fixed logo navigation behavior to respond to authentication state
    • Enhanced authentication initialization error handling to gracefully manage failures
    • Corrected sign-up page link routing

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ada626c4-dfc3-469f-8fde-7ecea69fe8cd

📥 Commits

Reviewing files that changed from the base of the PR and between 0c75f69 and ee88c17.

📒 Files selected for processing (3)
  • app/pages/(auth)/login.vue
  • app/pages/(auth)/register.vue
  • app/plugins/auth.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/pages/(auth)/register.vue

📝 Walkthrough

Walkthrough

Authentication state management refactored across components and composables. The useAuth composable now derives computed properties from session data sourced via Nuxt plugin, while AppHeader updates its UI bindings to use user state. Auth plugin initialization wrapped with error handling, and page redirects modified to rely on watchers instead of explicit navigation calls.

Changes

Cohort / File(s) Summary
AppHeader UI Bindings
app/components/AppHeader.vue
Switched from session to user for authentication checks. Updated handleSignOut with try/catch/finally and error logging. Added logoTo computed for dynamic routing ('/library' when authenticated, '/login' otherwise). Simplified menu to show only "Sign Out" when authenticated, empty array otherwise.
Auth Composable Refactor
app/composables/auth.ts
Restructured useAuth to derive user, isAuthenticated, isPending, and error computed refs from session sourced via Nuxt plugin. Changed signOut to await the auth client method. Modified return shape to expose session: userSession instead of raw session object.
Auth Plugin Initialization
app/plugins/auth.ts
Wrapped authClient.useSession() initialization in try/catch with fallback object on failure. Logs errors and provides safe defaults (data: null, isPending: false) to prevent undefined state.
Authentication Pages
app/pages/(auth)/login.vue, app/pages/(auth)/register.vue
Refactored login to use mutable isFromSignout ref with watcher logic to prevent repeated redirects and handle post-signout state. Removed explicit navigateTo calls post-authentication in both pages, relying on auth-state watchers instead. Updated register sign-up link path to /register.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Hopping through auth flows, I spy,
State deriving from on high,
Plugins catch what might break,
Pages trust the watcher's wake,
Cleaner paths for every way!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'Remove landing page' does not clearly relate to the actual changes made. The changeset involves substantial refactoring of authentication state management (switching from session to user, restructuring auth composables, updating sign-out flow) and adjusting navigation logic across multiple auth-related pages, but does not describe removing a landing page. Revise the title to reflect the primary change, such as 'Refactor authentication state management and update auth page navigation' or 'Switch auth state usage from session to user with updated sign-out flow'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/remove-landing-page

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/pages/(auth)/register.vue (1)

67-70: ⚠️ Potential issue | 🟡 Minor

.refine() uses the deprecated message parameter — replace with error.

Zod v4 introduces a single unified error parameter for customizing errors, replacing message. The message parameter is still supported but deprecated. The official Zod v4 docs show .refine() using { error: "..." } in its params object.

♻️ Proposed fix
 }).refine(data => data.password === data.confirmPassword, {
-  message: 'Passwords do not match',
+  error: 'Passwords do not match',
   path: ['confirmPassword']
 })

Based on learnings, in TypeScript files using Zod v4.3.5 or newer, use the error option for both schema-level configuration and validators. The message parameter is deprecated.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/pages/`(auth)/register.vue around lines 67 - 70, The Zod refine call that
enforces password equality (the .refine(data => data.password ===
data.confirmPassword, { message: 'Passwords do not match', path:
['confirmPassword'] })) uses the deprecated message option; update the second
argument to use the new { error: 'Passwords do not match', path:
['confirmPassword'] } shape so schema-level validation uses the unified error
property instead of message (locate the .refine(...) on the registration
schema).
🧹 Nitpick comments (2)
app/composables/auth.ts (1)

15-20: Inconsistent reactive-value access between isPending and error/data.

isPending defensively uses unref() to handle both Ref<boolean> and a plain boolean, but error (line 20) directly accesses .value, implicitly assuming it is always a Ref. If better-auth ever returns error as a plain value, session.error.value silently yields undefined, which the ?? null fallback hides. Apply the same unref pattern — or nail down the type — for consistency.

♻️ Proposed fix
-  const error = computed(() => session.error.value ?? null)
+  const error = computed(() => unref(session.error) ?? null)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/composables/auth.ts` around lines 15 - 20, The computed for error is
inconsistent with isPending: instead of directly using session.error.value
(which assumes a Ref), use unref(session.error) the same way isPending uses
unref to handle both Ref and plain values (apply the same to session.data if
present); update the computed named error (and any computed accessing
session.data) to return unref(session.error) ?? null (and unref(session.data) ??
null) or alternatively enforce the session types so those properties are always
Refs—locate the computed declarations named isPending and error in this file to
make the change.
app/pages/(auth)/register.vue (1)

16-17: isFromSignout is dead code on the register page.

Sign-out always navigates to /login?signout=true, so a user landing on /register will never have ?signout=true in the query. This guard can be removed.

♻️ Proposed fix
-// Redirect if already logged in (but not if we just signed out - race condition with stale state)
-const isFromSignout = computed(() => route.query.signout === 'true')
-
 watch(user, (newUser) => {
-  // Skip auto-redirect if we just came from sign-out (stale user state may still be present)
-  if (isFromSignout.value) return
-
   if (newUser) {
     navigateTo('/library')
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/pages/`(auth)/register.vue around lines 16 - 17, The computed
isFromSignout (const isFromSignout = computed(() => route.query.signout ===
'true')) is dead code on the register page and should be removed; delete the
isFromSignout declaration and any references to it in register.vue and simplify
the redirect/guard logic (where you check login state) to rely only on the
existing isLoggedIn/isAuthenticated check (or equivalent) so the page no longer
branches on route.query.signout.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/components/AppHeader.vue`:
- Around line 6-10: handleSignOut currently awaits signOut() and will skip
navigateTo('/login?signout=true') if signOut rejects; wrap the signOut call in
try/catch (or try/finally) inside the handleSignOut function so errors from
signOut are caught, log or surface the error (e.g., console.error or a
user-facing notification) in the catch, and ensure
navigateTo('/login?signout=true') still runs (use finally or call navigateTo in
both success and catch paths) so the user is always redirected after attempting
to sign out.

In `@app/pages/`(auth)/login.vue:
- Around line 28-35: Remove the redundant navigateTo call from the onSubmit
flow: since the watch on user (watch(user, ...) with immediate: true) performs
navigateTo(redirectPath.value) when a new user appears (and skips when
isFromSignout.value is true), delete the explicit navigateTo(redirectPath.value)
inside the onSubmit method (the call at line 83) so only the watcher handles
post-sign-in redirects; leave other onSubmit logic (error handling, signIn
invocation) intact.

In `@app/pages/`(auth)/register.vue:
- Around line 19-26: The watcher on `user` already handles post-registration
navigation to '/library' (see the `watch(user, ...)` block), so remove the
duplicate `navigateTo('/library')` call from the `onSubmit` handler to avoid
double navigation; locate the `onSubmit` function (the form submit handler
around lines 74-99) and delete the `navigateTo('/library')` invocation there,
leaving the watcher-based navigation in place and ensuring any related tests or
comments are updated accordingly.

In `@app/plugins/auth.ts`:
- Around line 3-14: Wrap the async initialization in defineNuxtPlugin in a
try/catch around the authClient.useSession(useFetch) call (inside the plugin
returned by defineNuxtPlugin), so any rejection is caught; on error log it via
the app logger or console and return a safe fallback (e.g., an empty or null
reactive session object) as the provided authSession to avoid crashing app
startup; ensure the plugin still returns the provide object with authSession
whether the call succeeds or fails and reference authClient.useSession, useFetch
and the provided authSession key when applying the change.

---

Outside diff comments:
In `@app/pages/`(auth)/register.vue:
- Around line 67-70: The Zod refine call that enforces password equality (the
.refine(data => data.password === data.confirmPassword, { message: 'Passwords do
not match', path: ['confirmPassword'] })) uses the deprecated message option;
update the second argument to use the new { error: 'Passwords do not match',
path: ['confirmPassword'] } shape so schema-level validation uses the unified
error property instead of message (locate the .refine(...) on the registration
schema).

---

Nitpick comments:
In `@app/composables/auth.ts`:
- Around line 15-20: The computed for error is inconsistent with isPending:
instead of directly using session.error.value (which assumes a Ref), use
unref(session.error) the same way isPending uses unref to handle both Ref and
plain values (apply the same to session.data if present); update the computed
named error (and any computed accessing session.data) to return
unref(session.error) ?? null (and unref(session.data) ?? null) or alternatively
enforce the session types so those properties are always Refs—locate the
computed declarations named isPending and error in this file to make the change.

In `@app/pages/`(auth)/register.vue:
- Around line 16-17: The computed isFromSignout (const isFromSignout =
computed(() => route.query.signout === 'true')) is dead code on the register
page and should be removed; delete the isFromSignout declaration and any
references to it in register.vue and simplify the redirect/guard logic (where
you check login state) to rely only on the existing isLoggedIn/isAuthenticated
check (or equivalent) so the page no longer branches on route.query.signout.

Comment thread app/components/AppHeader.vue
Comment thread app/pages/(auth)/login.vue
Comment thread app/pages/(auth)/register.vue
Comment thread app/plugins/auth.ts
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/pages/`(auth)/login.vue:
- Around line 25-35: The watcher currently checks computed isFromSignout (based
on route.query.signout) which remains true for the page lifetime and blocks
later successful sign-ins; change this to a one-shot guard by introducing a
local mutable flag (e.g., consumedSignout or signoutConsumedRef) initialized
from route.query.signout === 'true' (instead of using a computed tied to route)
and inside the watch(user, ...) when you return early because of the signout
flag, set that local flag to false (consume it) so subsequent user changes will
redirect via navigateTo(redirectPath.value); update references from
isFromSignout to the new mutable flag and do not persistently rely on
route.query.signout.

In `@app/plugins/auth.ts`:
- Around line 12-15: The fallback session in app/plugins/auth.ts currently sets
session.error to ref(null), which hides bootstrap initialization failures
exposed by useAuth() and $authSession.error (see app/composables/auth.ts:11-20);
update the fallback to preserve and forward the actual bootstrap error instead
of always null — e.g., accept or capture the bootstrap error used during
initialization and assign session.error = ref(bootstrapError) (or wrap it into
the existing reactive session object) so consumers see the real initialization
error rather than a signed-out state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1006660d-6ff1-4be5-a555-cb8f023ecb27

📥 Commits

Reviewing files that changed from the base of the PR and between 30be56c and 0c75f69.

📒 Files selected for processing (5)
  • app/components/AppHeader.vue
  • app/composables/auth.ts
  • app/pages/(auth)/login.vue
  • app/pages/(auth)/register.vue
  • app/plugins/auth.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/composables/auth.ts
  • app/pages/(auth)/register.vue

Comment thread app/pages/(auth)/login.vue
Comment thread app/plugins/auth.ts
@niklhut niklhut merged commit 732d37d into main Apr 4, 2026
2 checks passed
@niklhut niklhut deleted the feat/remove-landing-page branch April 4, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant