Skip to content

Settings page crashes for unauthenticated users#4267

Merged
ncarazon merged 1 commit intomainfrom
fix/settings-page-unauthenticated-crash
Feb 9, 2026
Merged

Settings page crashes for unauthenticated users#4267
ncarazon merged 1 commit intomainfrom
fix/settings-page-unauthenticated-crash

Conversation

@ncarazon
Copy link
Contributor

@ncarazon ncarazon commented Feb 6, 2026

Closes #4236

This PR fixes the account settings page crash for unauthenticated users by adding a redirect to the login page instead of throwing an invariant error.

Changes:

  • Added null check for currentUser in account settings page
  • Redirect unauthenticated users to login page instead of crashing
  • Fixes high-volume Sentry issue (1,230 events since September)

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling on account settings (General, Account, Notifications): users without an active profile are now redirected to the home page instead of encountering runtime errors, resulting in a smoother, more reliable experience.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

Three settings page components now redirect to "/" when currentUser is falsy instead of asserting with ts-invariant, avoiding runtime throws for unauthenticated access.

Changes

Cohort / File(s) Summary
Settings Pages Authentication Guards
front_end/src/app/(main)/accounts/settings/(general)/page.tsx, front_end/src/app/(main)/accounts/settings/account/page.tsx, front_end/src/app/(main)/accounts/settings/notifications/page.tsx
Replace ts-invariant assertion with Next.js redirect() from next/navigation. Pages perform an early return redirect("/") when currentUser is falsy instead of throwing via invariant.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 I hopped through code with careful feet,
Replaced loud crashes with a gentle beat.
When users wander without a key,
I nudge them home — safe as can be. ✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: fixing crashes for unauthenticated users on settings pages.
Linked Issues check ✅ Passed All code changes successfully address the linked issue #4236 by replacing invariant assertions with redirects across all three settings pages.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the unauthenticated user crash issue; no out-of-scope modifications detected.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/settings-page-unauthenticated-crash

No actionable comments were generated in the recent review. 🎉


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.

@ncarazon ncarazon force-pushed the fix/settings-page-unauthenticated-crash branch from 0c5049b to fdb593c Compare February 9, 2026 08:03
@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

🧹 Preview Environment Cleaned Up

The preview environment for this PR has been destroyed.

Resource Status
🌐 Preview App ✅ Deleted
🗄️ PostgreSQL Branch ✅ Deleted
⚡ Redis Database ✅ Deleted
🔧 GitHub Deployments ✅ Removed
📦 Docker Image ⚠️ Retained (auto-cleanup via GHCR policies)

Cleanup triggered by PR close at 2026-02-09T08:51:18Z

@ncarazon ncarazon merged commit 5f31e2c into main Feb 9, 2026
14 checks passed
@ncarazon ncarazon deleted the fix/settings-page-unauthenticated-crash branch February 9, 2026 08:51
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.

Settings page crashes for unauthenticated users

4 participants