From f6f893fbf77cf574d65e7d88885d479649a56012 Mon Sep 17 00:00:00 2001 From: Etrenak <21969306+Etrenak@users.noreply.github.com> Date: Tue, 10 Sep 2024 05:22:03 +0200 Subject: [PATCH] fix: prefill advanced field settings in templates (#1332) ## Description Seems like I was overconfident in #1323 and I did not test properly. Currently, the advanced settings for a field in a **template** is not pre-filled with the current fieldMeta, although it is correctly pre-filled in a **draft document** (That's probably where I messed up my testing). In this PR, I propose to directly use the fieldMeta provided by the field prop in `FieldAdvancedSettings`, instead of multiplying tRPCs to request the fieldMeta while we already have it. I apologize for the wasted time in reviewing my previous PR which was only correcting the display of the field label in the template view. ## Testing Performed - This time, I correctly checked that the advanced settings for a field is correctly pre-filled both in a document draft and in a template. - `npm run build` builds correctly. --- packages/lib/translations/de/common.po | 8 ++++---- packages/lib/translations/en/common.po | 8 ++++---- .../document-flow/field-item-advanced-settings.tsx | 12 +----------- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/packages/lib/translations/de/common.po b/packages/lib/translations/de/common.po index 54072b816..335026116 100644 --- a/packages/lib/translations/de/common.po +++ b/packages/lib/translations/de/common.po @@ -148,7 +148,7 @@ msgstr "" msgid "Blue" msgstr "" -#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:297 +#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:287 #: packages/ui/primitives/document-flow/send-document-action-dialog.tsx:58 msgid "Cancel" msgstr "Abbrechen" @@ -283,7 +283,7 @@ msgstr "Direktlink-Signierung aktivieren" msgid "Enter password" msgstr "Passwort eingeben" -#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:226 +#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:216 msgid "Error" msgstr "Fehler" @@ -292,7 +292,7 @@ msgstr "Fehler" msgid "External ID" msgstr "Externe ID" -#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:227 +#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:217 msgid "Failed to save settings." msgstr "Einstellungen konnten nicht gespeichert werden." @@ -514,7 +514,7 @@ msgstr "Pflichtfeld" msgid "Rows per page" msgstr "Zeilen pro Seite" -#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:296 +#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:286 msgid "Save" msgstr "Speichern" diff --git a/packages/lib/translations/en/common.po b/packages/lib/translations/en/common.po index 96065c3a2..db14b8f8d 100644 --- a/packages/lib/translations/en/common.po +++ b/packages/lib/translations/en/common.po @@ -143,7 +143,7 @@ msgstr "Black" msgid "Blue" msgstr "Blue" -#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:297 +#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:287 #: packages/ui/primitives/document-flow/send-document-action-dialog.tsx:58 msgid "Cancel" msgstr "Cancel" @@ -278,7 +278,7 @@ msgstr "Enable Direct Link Signing" msgid "Enter password" msgstr "Enter password" -#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:226 +#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:216 msgid "Error" msgstr "Error" @@ -287,7 +287,7 @@ msgstr "Error" msgid "External ID" msgstr "External ID" -#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:227 +#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:217 msgid "Failed to save settings." msgstr "Failed to save settings." @@ -509,7 +509,7 @@ msgstr "Required field" msgid "Rows per page" msgstr "Rows per page" -#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:296 +#: packages/ui/primitives/document-flow/field-item-advanced-settings.tsx:286 msgid "Save" msgstr "Save" diff --git a/packages/ui/primitives/document-flow/field-item-advanced-settings.tsx b/packages/ui/primitives/document-flow/field-item-advanced-settings.tsx index 23eb76b74..03ee767c0 100644 --- a/packages/ui/primitives/document-flow/field-item-advanced-settings.tsx +++ b/packages/ui/primitives/document-flow/field-item-advanced-settings.tsx @@ -155,17 +155,7 @@ export const FieldAdvancedSettings = forwardRef