From 9e3954865a2de182503422c19f93648c35c5eccf Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 4 Oct 2017 13:15:38 +0100 Subject: [PATCH] Fix a couple of bugs with EditableItemList - fix entering the same thing twice (which had the bug of not emptying the "new" field) - fix editing items in the list (which would stack overflow because of typo) --- src/components/views/elements/EditableItemList.js | 2 +- src/components/views/elements/EditableText.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/views/elements/EditableItemList.js b/src/components/views/elements/EditableItemList.js index 267244759a..35e207daef 100644 --- a/src/components/views/elements/EditableItemList.js +++ b/src/components/views/elements/EditableItemList.js @@ -104,7 +104,7 @@ module.exports = React.createClass({ if (value.length === 0) { this.onItemRemoved(index); } else { - this.onItemEdited(value, index); + this.props.onItemEdited(value, index); } }, diff --git a/src/components/views/elements/EditableText.js b/src/components/views/elements/EditableText.js index 3ce8c90447..b6a0ec1d5c 100644 --- a/src/components/views/elements/EditableText.js +++ b/src/components/views/elements/EditableText.js @@ -65,7 +65,9 @@ module.exports = React.createClass({ }, componentWillReceiveProps: function(nextProps) { - if (nextProps.initialValue !== this.props.initialValue) { + if (nextProps.initialValue !== this.props.initialValue || + nextProps.initialValue !== this.value + ) { this.value = nextProps.initialValue; if (this.refs.editable_div) { this.showPlaceholder(!this.value);