From 496b1ed464188e59ff6f3e1cf39867e1d9dd03c4 Mon Sep 17 00:00:00 2001 From: Jethary Date: Thu, 8 Feb 2024 15:49:48 -0500 Subject: [PATCH] fix manualIpHostnameForm --- .../AppSettings/ManualIpHostnameForm.tsx | 19 +++++++++++-------- .../ConnectNetwork/ConnectModal/FormModal.tsx | 5 ++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/src/organisms/AppSettings/ManualIpHostnameForm.tsx b/app/src/organisms/AppSettings/ManualIpHostnameForm.tsx index 54ee765cbc2..e71f67d8257 100644 --- a/app/src/organisms/AppSettings/ManualIpHostnameForm.tsx +++ b/app/src/organisms/AppSettings/ManualIpHostnameForm.tsx @@ -82,13 +82,17 @@ export function ManualIpHostnameForm({ if (!ip) { message = t('add_ip_error') } - return { - ...errors, - ip: { - type: 'error', - message: message, - }, - } + const updatedErrors = + message != null + ? { + ...errors, + ip: { + type: 'error', + message: message, + }, + } + : errors + return updatedErrors } const resolver: Resolver = values => { @@ -103,7 +107,6 @@ export function ManualIpHostnameForm({ }, resolver: resolver, }) -console.log('errors', formState.errors) const onSubmit = (data: FormValues): void => { const trimmedIp = data.ip.trim() diff --git a/app/src/organisms/Devices/RobotSettings/ConnectNetwork/ConnectModal/FormModal.tsx b/app/src/organisms/Devices/RobotSettings/ConnectNetwork/ConnectModal/FormModal.tsx index 85d9ddf1eea..3ef26c600da 100644 --- a/app/src/organisms/Devices/RobotSettings/ConnectNetwork/ConnectModal/FormModal.tsx +++ b/app/src/organisms/Devices/RobotSettings/ConnectNetwork/ConnectModal/FormModal.tsx @@ -1,5 +1,5 @@ import * as React from 'react' -import { Controller } from 'react-hook-form' +import { Control, Controller } from 'react-hook-form' import styled, { css } from 'styled-components' import { @@ -91,6 +91,7 @@ export const FormModal = (props: FormModalProps): JSX.Element => { ( { ( { (