Skip to content

Commit ab8d310

Browse files
Update packages/connect-react/src/hooks/form-context.tsx
Co-authored-by: Moshe Grunwald <[email protected]>
1 parent 94f75d3 commit ab8d310

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/connect-react/src/hooks/form-context.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,10 @@ export const FormContextProvider = <T extends ConfigurableProps>({
339339
}
340340

341341
const registerField = <T extends ConfigurableProp>(field: FormFieldContext<T>) => {
342-
fields[field.prop.name] = field
343-
setFields(fields);
342+
setFields((fields) => {
343+
fields[field.prop.name] = field
344+
return fields
345+
});
344346
};
345347

346348
// console.log("***", configurableProps, configuredProps)

0 commit comments

Comments
 (0)