From f8939a6817ec2a044019922d9d6de784466535da Mon Sep 17 00:00:00 2001 From: Sergei Date: Thu, 22 Jan 2026 13:40:21 -0800 Subject: [PATCH] fix: Use server-provided displayName for beneficiaries list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When customName is NULL, originalName should be shown. Now uses beneficiary.displayName from server instead of local computation (customName || name). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/(tabs)/index.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx index 29a6216..9b8e960 100644 --- a/app/(tabs)/index.tsx +++ b/app/(tabs)/index.tsx @@ -89,8 +89,8 @@ function BeneficiaryCard({ beneficiary, onPress, onActivate }: BeneficiaryCardPr const statusConfig = equipmentStatus ? equipmentStatusConfig[equipmentStatus as keyof typeof equipmentStatusConfig] : equipmentStatusConfig.none; - // Display name: customName (e.g., "Mom") if set, otherwise full name - const displayName = beneficiary.customName || beneficiary.name; + // Use server-provided displayName (customName || originalName) + const displayName = beneficiary.displayName; // Check if avatar is valid (not empty, null, or placeholder) const hasValidAvatar = beneficiary.avatar && @@ -226,7 +226,6 @@ export default function HomeScreen() { } // Show error when API fails const errorMessage = response.error?.message || 'Failed to load beneficiaries'; - console.error('[HomeScreen] Failed to load beneficiaries:', errorMessage); setError(errorMessage); setBeneficiaries([]); } @@ -241,7 +240,6 @@ export default function HomeScreen() { return; } } catch (err) { - console.error('Failed to load beneficiaries:', err); setError('Failed to load beneficiaries'); setBeneficiaries([]); } finally { @@ -263,10 +261,9 @@ export default function HomeScreen() { const handleActivate = (beneficiary: Beneficiary) => { setCurrentBeneficiary(beneficiary); - const lovedOneName = beneficiary.customName || beneficiary.name; router.push({ pathname: '/(auth)/activate', - params: { lovedOneName, beneficiaryId: beneficiary.id.toString() }, + params: { lovedOneName: beneficiary.displayName, beneficiaryId: beneficiary.id.toString() }, }); };