Skip to content

Commit 3efcb4f

Browse files
committed
added extra debug logging for reset
1 parent 5357bb7 commit 3efcb4f

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 4.59.1 ( May 7th, 2024)
2+
3+
### Added
4+
5+
- Extra debug logging for reset
6+
17
## 4.59.0 ( May 7th, 2024)
28

39
### Added

src/FormController.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,8 +1234,11 @@ export class FormController {
12341234
}
12351235

12361236
reset(options = {}) {
1237+
debug('Resetting Form');
1238+
12371239
// There are cases where we dont want to blow away all the form values
12381240
if (this.options.current.resetOnlyOnscreen) {
1241+
debug('Resetting only onscreen inputs');
12391242
this.state.initialValues = this.options.current.initialValues ?? {};
12401243
this.fieldsMap.forEach(fieldMeta => {
12411244
fieldMeta.current.fieldApi.reset({ resetValue: resetValues });
@@ -1270,6 +1273,7 @@ export class FormController {
12701273
};
12711274

12721275
this.fieldsMap.forEach(fieldMeta => {
1276+
debug(`Resetting the field, ${fieldMeta.current.name}`);
12731277
fieldMeta.current.fieldApi.reset({ resetValue: resetValues });
12741278
});
12751279

src/hooks/useForm.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ export const useForm = ({
206206
// If the form is pristine then reset it when we get new initial values !
207207
const { pristine } = formApi.getFormState();
208208
if (pristine) {
209+
logger(
210+
'Resetting entire form as form is pristine and we got new initial values'
211+
);
209212
formApi.reset();
210213
}
211214
},

0 commit comments

Comments
 (0)