fix(profile): one display-name bound, checked after trimming

The setup flow capped a display name at 50 characters while the profile
took 80, and the profile checked its minimum before trimming, so a name
of only spaces was stored as an empty string. Every surface now reads
one bound (80), the profile trims before validating, and only spaces
means no name on both paths: the profile clears it to null, the setup
flow leaves it unset.
This commit is contained in:
Marc-André Bombeck committed 2026-10-21 15:06:57 +02:00
1 parent a264dee030
commit 03cacc996c
11 files changed
+93 -11

No files matched your search

@@ -1,5 +1,6 @@
"use client";
import { DISPLAY_NAME_MAX_LENGTH } from "@/lib/validations/display-name";
import { Input } from "@/components/ui/input";
import { DateField } from "@/components/ui/date-field";
import { FieldGroup } from "@/components/ui/field-group";
@@ -98,7 +99,7 @@ export function BaselineFields({
onChange={(e) => onChange("displayName", e.target.value)}
disabled={readOnlyDisplayName}
autoComplete="nickname"
maxLength={50}
maxLength={DISPLAY_NAME_MAX_LENGTH}
placeholder={t("onboarding.baseline.displayNamePlaceholder")}
aria-invalid={errors.displayName ? true : undefined}
aria-describedby={
@@ -1,5 +1,6 @@
"use client";
import { DISPLAY_NAME_MAX_LENGTH } from "@/lib/validations/display-name";
import { useState } from "react";
import { Button } from "@/components/ui/button";
@@ -176,7 +177,7 @@ export function ManagedProfileCreateForm({
}}
placeholder={t("recordSharing.managed.namePlaceholder")}
autoComplete="off"
maxLength={80}
maxLength={DISPLAY_NAME_MAX_LENGTH}
aria-invalid={
displayName.length > 0 && nameIssue !== null ? "true" : undefined
}
@@ -1,5 +1,6 @@
"use client";
import { DISPLAY_NAME_MAX_LENGTH } from "@/lib/validations/display-name";
import { useState, type FormEvent } from "react";
import { Loader2 } from "lucide-react";
@@ -213,7 +214,7 @@ function ManagedProfileEditFields({
setError(null);
}}
autoComplete="off"
maxLength={80}
maxLength={DISPLAY_NAME_MAX_LENGTH}
aria-invalid={nameIssue !== null ? "true" : undefined}
/>
<FieldGuidance
@@ -1,5 +1,6 @@
"use client";
import { DISPLAY_NAME_MAX_LENGTH } from "@/lib/validations/display-name";
import { useCallback, useEffect, useState } from "react";
import { useRouter } from "next/navigation";
import { Languages, Loader2, Save, User } from "lucide-react";
@@ -475,7 +476,7 @@ export function AccountSection() {
clearFieldError("displayName");
}}
placeholder={t("onboarding.baseline.displayNamePlaceholder")}
maxLength={80}
maxLength={DISPLAY_NAME_MAX_LENGTH}
autoComplete="nickname"
enterKeyHint="next"
aria-invalid={fieldErrors.displayName ? true : undefined}