Skip to content

Commit a1cfcd3

Browse files
authored
Merge pull request #120 from workfloworchestrator/contact-field-adjustments
Contact field adjustments
2 parents 0fddde0 + 42c007a commit a1cfcd3

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'pydantic-forms': minor
3+
---
4+
5+
Set width to 100% for RenderFields, add resetErrorDetails

frontend/packages/pydantic-forms/src/components/render/RenderFields.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function RenderFields({
2828

2929
if (isControlledElement) {
3030
return (
31-
<div key={field.id}>
31+
<div css={{ width: '100%' }} key={field.id}>
3232
<WrapFieldElement
3333
PydanticFormControlledElement={Element}
3434
pydanticFormField={field}

frontend/packages/pydantic-forms/src/core/PydanticFormContextProvider.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ function PydanticFormContextProvider({
336336
[resetFormData, rhf],
337337
);
338338

339+
const resetErrorDetails = useCallback(() => {
340+
setErrorDetails(undefined);
341+
}, []);
342+
339343
// with this we have the possibility to have listeners for specific fields
340344
// this could be used to trigger validations of related fields, casting changes to elsewhere, etc.
341345
useEffect(() => {
@@ -389,6 +393,7 @@ function PydanticFormContextProvider({
389393
isFullFilled,
390394
customDataProvider,
391395
errorDetails,
396+
resetErrorDetails,
392397
successNotice,
393398
submitForm,
394399
resetForm,

frontend/packages/pydantic-forms/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export interface PydanticFormContextProps {
5353
isFullFilled: boolean;
5454
rhf: ReturnType<typeof useForm>;
5555
errorDetails?: PydanticFormValidationErrorDetails;
56+
resetErrorDetails: () => void;
5657
pydanticFormSchema?: PydanticFormSchema;
5758
title?: string | boolean;
5859
sendLabel?: string;

0 commit comments

Comments
 (0)