Skip to content

Commit

Permalink
Merge pull request #277 from ensdomains/fix-invalid-warning
Browse files Browse the repository at this point in the history
Fix problem not showing warning on invalid address/content
  • Loading branch information
jefflau authored May 8, 2019
2 parents 7f24f2e + f493a86 commit 0c72e90
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/components/SingleName/AddRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function Editable({ domain, emptyRecords, refetch }) {
value: newValue,
contentType: domain.contentType
})
const isInvalid = newValue !== "" && !isValid
return (
<>
<RecordsTitle>
Expand Down Expand Up @@ -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}
/>
</Row>
{selectedRecord ? (
Expand Down
2 changes: 1 addition & 1 deletion src/components/SingleName/RecordsItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ const Editable = ({
value: newValue,
contentType: domain.contentType
})
const isInvalid = !isValid && newValue.length > 0 && type === 'address'

const isInvalid = newValue !== "" && !isValid
return (
<>
<Mutation
Expand Down
4 changes: 2 additions & 2 deletions src/utils/records.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export function validateRecord(record) {

const { type, value } = record

if (record.contentType === 'oldcontent') {
if (type == 'content' && record.contentType === 'oldcontent') {
return value.length > 32
}
console.log('validateRecord', { record })

switch (type) {
case 'address':
return addressUtils.isAddress(value)
Expand Down

0 comments on commit 0c72e90

Please sign in to comment.