From f493a86ee0ceb5ddd66d9d96a5c5867017e16194 Mon Sep 17 00:00:00 2001 From: Makoto Date: Tue, 7 May 2019 15:11:14 +0100 Subject: [PATCH] Fix problem not showing warning on invalid address/content --- src/components/SingleName/AddRecord.js | 5 +++-- src/components/SingleName/RecordsItem.js | 2 +- src/utils/records.js | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/SingleName/AddRecord.js b/src/components/SingleName/AddRecord.js index 59a003c60..b18a17935 100644 --- a/src/components/SingleName/AddRecord.js +++ b/src/components/SingleName/AddRecord.js @@ -97,6 +97,7 @@ function Editable({ domain, emptyRecords, refetch }) { value: newValue, contentType: domain.contentType }) + const isInvalid = newValue !== "" && !isValid return ( <> @@ -133,8 +134,8 @@ function Editable({ domain, emptyRecords, refetch }) { dataType={selectedRecord ? selectedRecord.value : null} contentType={domain.contentType} updateValue={updateValue} - valid={isValid} - invalid={!isValid} + isValid={isValid} + isInvalid={isInvalid} /> {selectedRecord ? ( diff --git a/src/components/SingleName/RecordsItem.js b/src/components/SingleName/RecordsItem.js index e8dabc40a..6b40712d1 100644 --- a/src/components/SingleName/RecordsItem.js +++ b/src/components/SingleName/RecordsItem.js @@ -118,8 +118,8 @@ const Editable = ({ value: newValue, contentType: domain.contentType }) - const isInvalid = !isValid && newValue.length > 0 && type === 'address' + const isInvalid = newValue !== "" && !isValid return ( <> 32 } - console.log('validateRecord', { record }) + switch (type) { case 'address': return addressUtils.isAddress(value)