Skip to content

Commit addec9b

Browse files
author
Ruben van Leeuwen
committed
2067: Call reset without argument instead of empty object when resetting
1 parent 1acbbb6 commit addec9b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,9 @@ function PydanticFormContextProvider({
209209
});
210210

211211
const resetFormData = useCallback(
212-
(inputData: object = {}) => {
213-
rhf.reset(inputData);
212+
(inputData?: object) => {
213+
// Resetting without inputData will reset to defaultValues
214+
rhf.reset(inputData || undefined);
214215
},
215216
[rhf],
216217
);

0 commit comments

Comments
 (0)