Skip to content

Commit

Permalink
fix: check if custom field is required to apply rule (#28428)
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipe Marins committed Apr 6, 2023
1 parent 8332fa6 commit 5b20104
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/meteor/client/components/CustomFieldsFormV2.tsx
Expand Up @@ -50,7 +50,7 @@ const CustomField = <T extends FieldValues>({
name={name}
control={control}
defaultValue={defaultValue ?? ''}
rules={{ required: t('The_field_is_required', label || name) }}
rules={{ required: required && t('The_field_is_required', label || name) }}
render={({ field, formState: { errors } }) => (
<Field>
<Field.Label>
Expand Down
Expand Up @@ -16,7 +16,7 @@ type CustomFieldProps = {
const CustomField = ({ id, value }: CustomFieldProps) => {
const t = useTranslation();
const getCustomField = useEndpoint('GET', '/v1/livechat/custom-fields/:_id', { _id: id });
const { data, isLoading, isError } = useQuery(['/v1/livechat/custom-fields', id], () => getCustomField());
const { data, isLoading, isError } = useQuery(['/v1/livechat/custom-field', id], () => getCustomField());

if (isLoading) {
return <FormSkeleton />;
Expand Down

0 comments on commit 5b20104

Please sign in to comment.