Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check if custom field is required to apply rule #28428

Merged
merged 14 commits into from Apr 6, 2023
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