mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
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.
This commit is contained in:
@ -155,17 +155,7 @@ export const FieldAdvancedSettings = forwardRef<HTMLDivElement, FieldAdvancedSet
|
||||
|
||||
const doesFieldExist = (!!document || !!template) && field.nativeId !== undefined;
|
||||
|
||||
const { data: fieldData } = trpc.field.getField.useQuery(
|
||||
{
|
||||
fieldId: Number(field.nativeId),
|
||||
teamId,
|
||||
},
|
||||
{
|
||||
enabled: doesFieldExist,
|
||||
},
|
||||
);
|
||||
|
||||
const fieldMeta = fieldData?.fieldMeta;
|
||||
const fieldMeta = field?.fieldMeta;
|
||||
|
||||
const localStorageKey = `field_${field.formId}_${field.type}`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user