From 52b3068330af95de73914ae04019305c68bf06ab Mon Sep 17 00:00:00 2001 From: bimlas Date: Fri, 18 May 2018 11:10:36 +0200 Subject: [PATCH] Refresh taglist to remove unused tags on deleting When a tag is deleted from a note, the taglist did not updated: the deleted tag was still in the list. If the tag was created in the current session, it was removed, worked as expected. The reason is: until the note is not updated, the tag list is not initialized for first in the "delete tag button" handler, but it works in the second case. Tried out using backspace to delete the tag, it works. --- browser/main/Detail/TagSelect.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/browser/main/Detail/TagSelect.js b/browser/main/Detail/TagSelect.js index e45d05bc..ce0b4f79 100644 --- a/browser/main/Detail/TagSelect.js +++ b/browser/main/Detail/TagSelect.js @@ -96,15 +96,16 @@ class TagSelect extends React.Component { } handleTagRemoveButtonClick (tag) { - return (e) => { - let { value } = this.props + let { value } = this.props - value.splice(value.indexOf(tag), 1) - value = _.uniq(value) + value = _.isArray(value) + ? value.slice() + : [] + value.splice(value.indexOf(tag), 1) + value = _.uniq(value) - this.value = value - this.props.onChange() - } + this.value = value + this.props.onChange() } render () { @@ -118,7 +119,7 @@ class TagSelect extends React.Component { > #{tag}