Skip to content

Commit 468e389

Browse files
authored
fix #100 (#101)
* fix #100 * fix lint * 3.2.0-0 * 3.3.0-0 * 4.0.0-0 * include reset and nested input example in story book * fix lint
1 parent fa374e5 commit 468e389

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hookform/devtools",
3-
"version": "3.1.0",
3+
"version": "4.0.0-0",
44
"description": "React Hook Form dev tool to help debugging forms",
55
"main": "dist/index.js",
66
"umd:main": "dist/index.umd.development.js",
@@ -95,7 +95,7 @@
9595
"prettier": "^2.2.1",
9696
"react": "^17.0.2",
9797
"react-dom": "^17.0.2",
98-
"react-hook-form": "7.3.5",
98+
"react-hook-form": "7.13.0",
9999
"rimraf": "^3.0.2",
100100
"rollup": "^2.45.2",
101101
"rollup-plugin-peer-deps-external": "^2.2.4",
@@ -108,7 +108,7 @@
108108
"peerDependencies": {
109109
"react": ">=17.0.2",
110110
"react-dom": ">=17.0.2",
111-
"react-hook-form": "^7.3.5"
111+
"react-hook-form": "^7.13.0"
112112
},
113113
"husky": {
114114
"hooks": {

src/panel.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,12 @@ function PanelChildren<T, K, L, M, G>({
101101
);
102102
}
103103

104-
const Panel = ({ control, control: { fieldsRef } }: { control: Control }) => {
104+
const Panel = ({ control, control: { _fields } }: { control: Control }) => {
105105
const formState = useFormState({
106106
control,
107107
});
108108
const { dirtyFields, touchedFields, errors } = formState;
109+
formState.isDirty;
109110
const { state, actions } = useStateMachine({
110111
setCollapse,
111112
});
@@ -192,7 +193,7 @@ const Panel = ({ control, control: { fieldsRef } }: { control: Control }) => {
192193
}}
193194
>
194195
<PanelChildren
195-
fields={fieldsRef.current}
196+
fields={_fields}
196197
searchTerm={searchTerm}
197198
errors={errors}
198199
touchedFields={touchedFields}

src/stories/devToolUI.stories.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ export default {
3232
} as Meta;
3333

3434
const Template: Story<Props> = (args) => {
35-
const { register, control, handleSubmit } = useForm<{
35+
const { register, control, reset, handleSubmit } = useForm<{
3636
firstName: string;
37+
test: {
38+
nested: string;
39+
};
3740
}>({
3841
mode: 'onChange',
3942
defaultValues: {
@@ -55,6 +58,15 @@ const Template: Story<Props> = (args) => {
5558
</p>
5659
<label>First Name</label>
5760
<input {...register('firstName', { required: true })} />
61+
<input {...register('test.nested', { required: true })} />
62+
<button
63+
type={'button'}
64+
onClick={() => {
65+
reset({});
66+
}}
67+
>
68+
reset
69+
</button>
5870
<input style={{ fontWeight: 400 }} type="submit" />
5971
</form>
6072

yarn.lock

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10299,10 +10299,10 @@ react-helmet-async@^1.0.7:
1029910299
react-fast-compare "^3.2.0"
1030010300
shallowequal "^1.1.0"
1030110301

10302-
react-hook-form@7.3.5:
10303-
version "7.3.5"
10304-
resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.3.5.tgz#8154fdf0401ddb6e8a5f8787f162a26839258f0d"
10305-
integrity sha512-T7PgHpFa4lPfVVnqm5+nDMB/CCrZ7OUBQC17ZXQ2QAZMxfc8qDbETo+Nrsd2TE5mszg6fT0bjb3EeE2DAzv7lQ==
10302+
react-hook-form@7.13.0:
10303+
version "7.13.0"
10304+
resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.13.0.tgz#af451e4771af2ddcb4ccb2f6a11eeb191c66bbdc"
10305+
integrity sha512-ofjzl78xNTRmBHFZ/gOn65HDiqM/LHxbVMlaFoemyMQIDFTR4aG4h2CpCG/N0TbW5IQbh21hBYUvvmqK0ByEhg==
1030610306

1030710307
react-inspector@^5.1.0:
1030810308
version "5.1.1"
@@ -12537,10 +12537,8 @@ watchpack@^1.7.4:
1253712537
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.7.5.tgz#1267e6c55e0b9b5be44c2023aed5437a2c26c453"
1253812538
integrity sha512-9P3MWk6SrKjHsGkLT2KHXdQ/9SNkyoJbabxnKOoJepsvJjJG8uYTR3yTPxPQvNDI3w4Nz1xnE0TLHK4RIVe/MQ==
1253912539
dependencies:
12540-
chokidar "^3.4.1"
1254112540
graceful-fs "^4.1.2"
1254212541
neo-async "^2.5.0"
12543-
watchpack-chokidar2 "^2.0.1"
1254412542
optionalDependencies:
1254512543
chokidar "^3.4.1"
1254612544
watchpack-chokidar2 "^2.0.1"

0 commit comments

Comments
 (0)