From f4753ebe15f70c6c12a7f7759f64e2f0e1cf27af Mon Sep 17 00:00:00 2001 From: Krishna Manocha Date: Fri, 15 May 2026 19:57:02 +0530 Subject: [PATCH] fix(dashboard): add custom error UI for non-existent users --- app/(root)/[username]/error.tsx | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/app/(root)/[username]/error.tsx b/app/(root)/[username]/error.tsx index 9ec46f7..724d6d6 100644 --- a/app/(root)/[username]/error.tsx +++ b/app/(root)/[username]/error.tsx @@ -2,6 +2,7 @@ import { useEffect } from 'react'; import Link from 'next/link'; +import { useParams } from 'next/navigation'; export default function DashboardError({ error, @@ -10,6 +11,10 @@ export default function DashboardError({ error: Error & { digest?: string }; reset: () => void; }) { + // Extract the username directly from the route parameters + const params = useParams(); + const username = params?.username as string; + useEffect(() => { // Log the error to an error reporting service console.error(error); @@ -23,11 +28,11 @@ export default function DashboardError({
-

{isNotFound ? '🕵️‍♂️' : isRateLimit ? '⏳' : '⚠️'}

+

{isNotFound ? '🪨🔨' : isRateLimit ? '⏳' : '⚠️'}

{isNotFound - ? 'User Not Found' + ? `User ${username ? `"${username}"` : ''} not found on GitHub` : isRateLimit ? 'API Limit Reached' : 'Something went wrong'} @@ -35,19 +40,21 @@ export default function DashboardError({

{isNotFound - ? "We couldn't find a GitHub user with that username. Please check the spelling and try again." + ? "We couldn't find a GitHub profile matching that username. Please check the spelling and try again." : isRateLimit ? "GitHub's API rate limit has been reached. Please add a GITHUB_TOKEN to your environment variables to increase the limit, or try again later." : error.message || 'An unexpected error occurred while fetching the dashboard data.'}

- + {!isNotFound && ( + + )}