From 0a29127f7e6cfa8be0867f5d243c4f776401a99e Mon Sep 17 00:00:00 2001 From: Anders Olsson Date: Fri, 5 Jun 2026 15:43:35 +0200 Subject: [PATCH] fix(web): name the field in the edit banner on create->fields-error redirect (#28) Co-Authored-By: Claude Sonnet 4.6 --- web/src/objects/object-edit-form.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/src/objects/object-edit-form.tsx b/web/src/objects/object-edit-form.tsx index 901eebe..4829973 100644 --- a/web/src/objects/object-edit-form.tsx +++ b/web/src/objects/object-edit-form.tsx @@ -17,9 +17,11 @@ export function ObjectEditForm() { const locationState = location.state as { fieldsError?: boolean; fieldErrorKey?: string } | null; - const [error, setError] = useState( - locationState?.fieldsError ? t("form.rejected") : null, - ); + const [error, setError] = useState(() => { + if (locationState?.fieldErrorKey) return t("form.fieldRejected", { field: locationState.fieldErrorKey }); + if (locationState?.fieldsError) return t("form.rejected"); + return null; + }); const [fieldErrorKey, setFieldErrorKey] = useState( locationState?.fieldErrorKey ?? null,