diff --git a/app/package.json b/app/package.json index 0394d787c50..65e32b92d54 100644 --- a/app/package.json +++ b/app/package.json @@ -40,7 +40,7 @@ "lodash": "4.17.21", "mixpanel-browser": "2.22.1", "netmask": "2.0.2", - "react-hook-form": "7.49.3", + "react-hook-form": "7.50.1", "path-to-regexp": "3.0.0", "react": "18.2.0", "react-dom": "18.2.0", diff --git a/app/src/organisms/AppSettings/ManualIpHostnameForm.tsx b/app/src/organisms/AppSettings/ManualIpHostnameForm.tsx index e71f67d8257..b94b0e6f429 100644 --- a/app/src/organisms/AppSettings/ManualIpHostnameForm.tsx +++ b/app/src/organisms/AppSettings/ManualIpHostnameForm.tsx @@ -72,6 +72,18 @@ export function ManualIpHostnameForm({ dispatch(startDiscovery()) } + const resolver: Resolver = values => { + let errors = {} + errors = validateForm(values, errors) + return { values, errors } + } + const { formState, handleSubmit, register, reset } = useForm({ + defaultValues: { + ip: '', + }, + resolver: resolver, + }) + const validateForm = ( data: FormValues, errors: Record @@ -95,19 +107,6 @@ export function ManualIpHostnameForm({ return updatedErrors } - const resolver: Resolver = values => { - let errors = {} - errors = validateForm(values, errors) - return { values, errors } - } - - const { formState, handleSubmit, register, reset } = useForm({ - defaultValues: { - ip: '', - }, - resolver: resolver, - }) - const onSubmit = (data: FormValues): void => { const trimmedIp = data.ip.trim() const inputForm = document.getElementById('ip') diff --git a/yarn.lock b/yarn.lock index b37d5dff006..7f38ee6e851 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1726,6 +1726,11 @@ dependencies: "@hapi/hoek" "^9.0.0" +"@hookform/resolvers@3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@hookform/resolvers/-/resolvers-3.1.1.tgz#b374d33e356428fff9c6ef3c933441fe15e40784" + integrity sha512-tS16bAUkqjITNSvbJuO1x7MXbn7Oe8ZziDTJdA9mMvsoYthnOOiznOTGBYwbdlYBgU+tgpI/BtTU3paRbCuSlg== + "@humanwhocodes/config-array@^0.11.13": version "0.11.14" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b" @@ -1744,10 +1749,6 @@ version "2.0.2" resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz#d9fae00a2d5cb40f92cfe64b47ad749fbc38f917" integrity sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw== -"@hookform/resolvers@3.1.1": - version "3.1.1" - resolved "https://registry.yarnpkg.com/@hookform/resolvers/-/resolvers-3.1.1.tgz#b374d33e356428fff9c6ef3c933441fe15e40784" - integrity sha512-tS16bAUkqjITNSvbJuO1x7MXbn7Oe8ZziDTJdA9mMvsoYthnOOiznOTGBYwbdlYBgU+tgpI/BtTU3paRbCuSlg== "@hutson/parse-repository-url@^3.0.0": version "3.0.2" @@ -2271,7 +2272,7 @@ react "18.2.0" react-dom "18.2.0" react-error-boundary "^4.0.10" - react-hook-form "7.49.3" + react-hook-form "7.50.1" react-i18next "13.5.0" react-intersection-observer "^8.33.1" react-redux "8.1.2" @@ -15139,13 +15140,6 @@ node-abi@^3.45.0: dependencies: semver "^7.3.5" -node-abi@^3.45.0: - version "3.54.0" - resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.54.0.tgz#f6386f7548817acac6434c6cba02999c9aebcc69" - integrity sha512-p7eGEiQil0YUV3ItH4/tBb781L5impVmmx2E9FRKF7d18XXzp4PGT2tdYMFY6wQqgxD0IwNZOiSJ0/K0fSi/OA== - dependencies: - semver "^7.3.5" - node-addon-api@^1.6.3: version "1.7.2" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.7.2.tgz#3df30b95720b53c24e59948b49532b662444f54d" @@ -17595,6 +17589,11 @@ react-hook-form@7.49.3: resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.49.3.tgz#576a4567f8a774830812f4855e89f5da5830435c" integrity sha512-foD6r3juidAT1cOZzpmD/gOKt7fRsDhXXZ0y28+Al1CHgX+AY1qIN9VSIIItXRq1dN68QrRwl1ORFlwjBaAqeQ== +react-hook-form@7.50.1: + version "7.50.1" + resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.50.1.tgz#f6aeb17a863327e5a0252de8b35b4fc8990377ed" + integrity sha512-3PCY82oE0WgeOgUtIr3nYNNtNvqtJ7BZjsbxh6TnYNbXButaD5WpjOmTjdxZfheuHKR68qfeFnEDVYoSSFPMTQ== + react-i18next@13.5.0: version "13.5.0" resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-13.5.0.tgz#44198f747628267a115c565f0c736a50a76b1ab0"