From 159253ef8f9bb125c770df8ac98053107055c478 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 15 Jan 2026 22:22:48 +0000
Subject: [PATCH 3/4] Improve code quality: extract variables, add error
handling, and fix type safety
Co-authored-by: notkainoa <123281048+notkainoa@users.noreply.github.com>
---
src/views/HomePageStatic.tsx | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/views/HomePageStatic.tsx b/src/views/HomePageStatic.tsx
index a53f447..ba1af6b 100644
--- a/src/views/HomePageStatic.tsx
+++ b/src/views/HomePageStatic.tsx
@@ -11,6 +11,7 @@ import { User } from "lucide-react";
export default function HomePageStatic() {
const navigate = useNavigate();
const [loadingTimeout, setLoadingTimeout] = useState(false);
+ const [imageError, setImageError] = useState(false);
const { openProfile } = useProfileOverlay();
const { data, isLoading, error } = useQuery({
@@ -29,6 +30,15 @@ export default function HomePageStatic() {
refetchOnWindowFocus: true,
});
+ // Extract avatar URL for better readability
+ const userMetadata = profileData?.data.session?.user.user_metadata;
+ const avatarUrl = userMetadata?.avatar_url || userMetadata?.picture;
+
+ // Reset image error when avatar URL changes
+ useEffect(() => {
+ setImageError(false);
+ }, [avatarUrl]);
+
// Set a timeout for loading state to prevent infinite loading
useEffect(() => {
if (isLoading) {
@@ -57,10 +67,11 @@ export default function HomePageStatic() {
navigate({ to: "/login", replace: true });
}
}
+
return (
{/* Account button in top-right when authenticated */}
- {data && (
+ {data === true && (