Skip to content

Commit de2d05f

Browse files
fix:ci error
1 parent 9575bfe commit de2d05f

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/content/docs/useform/reset.mdx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ Reset the entire form state, fields reference, and subscriptions. There are opti
1414

1515
`Reset` has the ability to retain formState. Here are the options you may use:
1616

17-
| Name | | Type | Description |
18-
| --------- | ------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
19-
| `values` | | <TypeText>object \| (values: Object) => Object </TypeText> | An optional object to reset form values, and it's recommended to provide the **entire** defaultValues when supplied. |
20-
| `options` | `keepErrors` | <TypeText>boolean</TypeText> | All errors will remain. This will not guarantee with further user actions. |
21-
| | `keepDirty` | <TypeText>boolean</TypeText> | `DirtyFields` form state will remain, and `isDirty` will temporarily remain as the current state until further user's action.<br/><br/>**Important:** this keep option doesn't reflect form input values but only dirty fields form state. |
22-
| | `keepDirtyValues` | <TypeText>boolean</TypeText> | `DirtyFields` and `isDirty` will remained, and only none dirty fields will be updated to the latest rest value. [Check out the example.](https://codesandbox.io/s/react-keepdirtyvalues-o8to91)<br/><br/>**Important:** formState `dirtyFields` will need to be subscribed. |
23-
| | `keepValues` | <TypeText>boolean</TypeText> | Form input values will be unchanged. |
24-
| | `keepDefaultValues` | <TypeText>boolean</TypeText> | Keep the same defaultValues which are initialised via `useForm`.<ul><li>`isDirty` will be checked again: it is set to be the result of the comparison of any new values provided against the original `defaultValues`.</li> <li>`dirtyFields` will be updated again if values are provided: it is set to be result of the comparison between the new values provided against the original `defaultValues`.</li></ul> |
25-
| | `keepIsSubmitted` | <TypeText>boolean</TypeText> | `isSubmitted` state will be unchanged. |
26-
| | `keepTouched` | <TypeText>boolean</TypeText> | `isTouched` state will be unchanged. |
27-
| | `keepIsValid` | <TypeText>boolean</TypeText> | `isValid` will temporarily persist as the current state until additional user actions. |
28-
| | `keepSubmitCount` | <TypeText>boolean</TypeText> | `submitCount` state will be unchanged. |
17+
| Name | | Type | Description |
18+
| --------- | ------------------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
19+
| `values` | | <TypeText>object \| (values: Object) => Object </TypeText> | An optional object to reset form values, and it's recommended to provide the **entire** defaultValues when supplied. |
20+
| `options` | `keepErrors` | <TypeText>boolean</TypeText> | All errors will remain. This will not guarantee with further user actions. |
21+
| | `keepDirty` | <TypeText>boolean</TypeText> | `DirtyFields` form state will remain, and `isDirty` will temporarily remain as the current state until further user's action.<br/><br/>**Important:** this keep option doesn't reflect form input values but only dirty fields form state. |
22+
| | `keepDirtyValues` | <TypeText>boolean</TypeText> | `DirtyFields` and `isDirty` will remained, and only none dirty fields will be updated to the latest rest value. [Check out the example.](https://codesandbox.io/s/react-keepdirtyvalues-o8to91)<br/><br/>**Important:** formState `dirtyFields` will need to be subscribed. |
23+
| | `keepValues` | <TypeText>boolean</TypeText> | Form input values will be unchanged. |
24+
| | `keepDefaultValues` | <TypeText>boolean</TypeText> | Keep the same defaultValues which are initialised via `useForm`.<ul><li>`isDirty` will be checked again: it is set to be the result of the comparison of any new values provided against the original `defaultValues`.</li> <li>`dirtyFields` will be updated again if values are provided: it is set to be result of the comparison between the new values provided against the original `defaultValues`.</li></ul> |
25+
| | `keepIsSubmitted` | <TypeText>boolean</TypeText> | `isSubmitted` state will be unchanged. |
26+
| | `keepTouched` | <TypeText>boolean</TypeText> | `isTouched` state will be unchanged. |
27+
| | `keepIsValid` | <TypeText>boolean</TypeText> | `isValid` will temporarily persist as the current state until additional user actions. |
28+
| | `keepSubmitCount` | <TypeText>boolean</TypeText> | `submitCount` state will be unchanged. |
2929

3030
<Admonition type="important" title="Rules">
3131

@@ -42,13 +42,13 @@ Reset the entire form state, fields reference, and subscriptions. There are opti
4242
```
4343
- It's fine to run `reset` without argument as long as you have provided a `defaultValues` at useForm.
4444

45-
```javascript
46-
reset(); // update form back to default values
45+
```javascript
46+
reset() // update form back to default values
4747

48-
reset({ test: 'test' }); // update your defaultValues && form values
48+
reset({ test: "test" }) // update your defaultValues && form values
4949

50-
reset(undefined, { keepDirtyValues: true }); // reset other form state but keep defaultValues and form values
51-
```
50+
reset(undefined, { keepDirtyValues: true }) // reset other form state but keep defaultValues and form values
51+
```
5252

5353
</Admonition>
5454

0 commit comments

Comments
 (0)