From f3af1eff670148895263c988371ce7311585d5f8 Mon Sep 17 00:00:00 2001 From: Boris Yankov Date: Wed, 30 May 2018 12:42:24 +0300 Subject: [PATCH] Change compose box inputs from controlled to 'not controlled' Fixes #2589 * make sure we do update input's initial values using `updateTextInput` in `componentDidMount` * remove the `value={...}` props that make the inputs controlled --- src/compose/ComposeBox.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/compose/ComposeBox.js b/src/compose/ComposeBox.js index 2fc07a40974..3a645dc10c2 100644 --- a/src/compose/ComposeBox.js +++ b/src/compose/ComposeBox.js @@ -247,6 +247,13 @@ class ComposeBox extends PureComponent { } }; + componentDidMount() { + const { message, topic } = this.state; + + updateTextInput(this.messageInput, message); + updateTextInput(this.topicInput, topic); + } + componentWillUnmount() { this.tryUpdateDraft(); } @@ -328,7 +335,6 @@ class ComposeBox extends PureComponent { onFocus={this.handleTopicFocus} onBlur={this.handleTopicBlur} onTouchStart={this.handleInputTouchStart} - value={topic} /> )} { messageInputRef(component); } }} - value={message} onBlur={this.handleMessageBlur} onChange={this.handleMessageChange} onFocus={this.handleMessageFocus}