From 107f5c6799a465b231cb6d8eb13d0352d90af62a Mon Sep 17 00:00:00 2001 From: Guillermo Pages Date: Fri, 7 Nov 2025 16:27:46 +0100 Subject: [PATCH] fix(admin): resolve click-to-edit blur closure bug in profile form Fixed critical bug where EditableField component would close after typing first character. Root cause was stale closure variable in onBlur handler. Changes: - Replace inline onBlur with handleBlur() function that evaluates current value at blur time instead of using stale hasValue closure variable - Fixes issue where typing first char would set hasValue=true in closure, causing immediate blur to close input Impact: Users can now fill in profile fields without being kicked out Related: BUILD #19 --- .../admin/clubs/[club_id]/tabs/ClubProfileTab.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app/[locale]/admin/clubs/[club_id]/tabs/ClubProfileTab.tsx b/src/app/[locale]/admin/clubs/[club_id]/tabs/ClubProfileTab.tsx index e9cf238..42144a3 100644 --- a/src/app/[locale]/admin/clubs/[club_id]/tabs/ClubProfileTab.tsx +++ b/src/app/[locale]/admin/clubs/[club_id]/tabs/ClubProfileTab.tsx @@ -36,13 +36,20 @@ function EditableField({ }: EditableFieldProps) { const hasValue = value && value.trim().length > 0; + function handleBlur() { + // Only close edit mode if field has content + if (value && value.trim().length > 0) { + onToggleEdit(); + } + } + if (isEditing || !hasValue) { return ( onChange(e.target.value)} - onBlur={() => hasValue && onToggleEdit()} + onBlur={handleBlur} autoFocus placeholder={placeholder} maxLength={maxLength}