1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

increase readability of the condition

This commit is contained in:
Baptiste Augrain
2018-10-16 20:30:15 +02:00
parent d8d5810d7c
commit 7484f6e6a6

View File

@@ -65,7 +65,9 @@ class MarkdownNoteDetail extends React.Component {
}
componentWillReceiveProps (nextProps) {
if (!this.state.isMovingNote && (nextProps.note.key !== this.props.note.key || nextProps.note.tags.length < this.props.note.tags.length)) {
const isNewNote = nextProps.note.key !== this.props.note.key
const hasDeletedTags = nextProps.note.tags.length < this.props.note.tags.length
if (!this.state.isMovingNote && (isNewNote || hasDeletedTags)) {
if (this.saveQueue != null) this.saveNow()
this.setState({
note: Object.assign({}, nextProps.note)