Skip to content

Commit

Permalink
Fix return immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
funzin authored and Rokt33r committed Jan 11, 2020
1 parent d7f8eb8 commit d628990
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/components/NotePage/NoteDetail/NoteDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import { includes } from 'ramda'
import {
NoteDoc,
NoteDocEditibleProps,
Expand Down Expand Up @@ -299,18 +300,17 @@ export default class NoteDetail extends React.Component<
}

appendNewTag = () => {
const includes = this.state.tags.includes(this.state.newTagName)
if (isTagNameValid(this.state.newTagName) && !includes) {
this.setState(
prevState => ({
newTagName: '',
tags: [...prevState.tags, prevState.newTagName]
}),
() => {
this.queueToSave()
}
)
}
if (includes(this.state.newTagName, this.state.tags)) { return }
if (!isTagNameValid(this.state.newTagName)) { return }
this.setState(
prevState => ({
newTagName: '',
tags: [...prevState.tags, prevState.newTagName]
}),
() => {
this.queueToSave()
}
)
}

removeTagByName = (tagName: string) => {
Expand Down

0 comments on commit d628990

Please sign in to comment.