From 6232cc58f0bbdbe9161aee984e15eecd3b6f0f01 Mon Sep 17 00:00:00 2001 From: Valknar XXX Date: Tue, 28 Oct 2025 11:21:42 +0100 Subject: [PATCH] fix: add null safety to logout button component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added null checks for user.name property to prevent SSR errors when the property is undefined. Made name and avatar properties optional in the User interface and added fallbacks to use email when name is not available. Fixes TypeError: Cannot read properties of undefined (reading 'split') that was occurring during server-side rendering. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../lib/components/logout-button/logout-button.svelte | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/frontend/src/lib/components/logout-button/logout-button.svelte b/packages/frontend/src/lib/components/logout-button/logout-button.svelte index 97ed1fb..6db2e15 100644 --- a/packages/frontend/src/lib/components/logout-button/logout-button.svelte +++ b/packages/frontend/src/lib/components/logout-button/logout-button.svelte @@ -3,9 +3,9 @@ import { Avatar, AvatarFallback, AvatarImage } from "$lib/components/ui/avatar"; import { getUserInitials } from "$lib/utils"; interface User { - name: string; + name?: string; email: string; - avatar: string; + avatar?: string; } interface Props { @@ -124,13 +124,13 @@ $effect(() => {