From 7484f6e6a6b0be52e061972329c86fc77e50db93 Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Tue, 16 Oct 2018 20:30:15 +0200 Subject: [PATCH] increase readability of the condition --- browser/main/Detail/MarkdownNoteDetail.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index af56a6de..a48aab72 100755 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -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)