diff --git a/packages/payload/src/fields/hooks/beforeChange/promise.ts b/packages/payload/src/fields/hooks/beforeChange/promise.ts index 46a43d1a52..401274f2c1 100644 --- a/packages/payload/src/fields/hooks/beforeChange/promise.ts +++ b/packages/payload/src/fields/hooks/beforeChange/promise.ts @@ -17,7 +17,9 @@ import { traverseFields } from './traverseFields.js' function buildFieldLabel(parentLabel: string, label: string): string { const capitalizedLabel = label.charAt(0).toUpperCase() + label.slice(1) - return parentLabel ? `${parentLabel} > ${capitalizedLabel}` : capitalizedLabel + return parentLabel && capitalizedLabel + ? `${parentLabel} > ${capitalizedLabel}` + : capitalizedLabel || parentLabel } type Args = { diff --git a/packages/ui/src/elements/Toasts/fieldErrors.tsx b/packages/ui/src/elements/Toasts/fieldErrors.tsx index 67baf3d997..d936d2fe1d 100644 --- a/packages/ui/src/elements/Toasts/fieldErrors.tsx +++ b/packages/ui/src/elements/Toasts/fieldErrors.tsx @@ -46,7 +46,8 @@ function createErrorsFromMessage(message: string): { if (errors.length === 1) { return { - message: `${intro}: ${errors[0]}`, + errors, + message: `${intro}:`, } } diff --git a/packages/ui/src/fields/Collapsible/index.tsx b/packages/ui/src/fields/Collapsible/index.tsx index b4a307fda1..4955fc40ec 100644 --- a/packages/ui/src/fields/Collapsible/index.tsx +++ b/packages/ui/src/fields/Collapsible/index.tsx @@ -107,7 +107,12 @@ const CollapsibleFieldComponent: CollapsibleFieldClientComponent = (props) => { return ( - +
= ({ isActive, parentPath, setIsAc const [errorCount, setErrorCount] = useState(undefined) const path = [ - ...(parentPath ? parentPath.split('.') : []), + // removes parent 'tabs' path segment, i.e. `_index-0` + ...(parentPath ? parentPath.split('.').slice(0, -1) : []), ...(tabHasName(tab) ? [tab.name] : []), - ].join('.') + ] const fieldHasErrors = errorCount > 0 return ( - +