Skip to content

Commit

Permalink
Change compose box inputs from controlled to 'not controlled'
Browse files Browse the repository at this point in the history
Fixes #2589

* make sure we do update input's initial values using `updateTextInput`
in `componentDidMount`
* remove the `value={...}` props that make the inputs controlled
  • Loading branch information
borisyankov committed Jun 27, 2018
1 parent 0f637e0 commit 4e8e6d0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/compose/ComposeBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,13 @@ class ComposeBox extends PureComponent<Props, State> {
}
};

componentDidMount() {
const { message, topic } = this.state;

updateTextInput(this.messageInput, message);
updateTextInput(this.topicInput, topic);
}

componentWillUnmount() {
this.tryUpdateDraft();
}
Expand Down Expand Up @@ -328,7 +335,6 @@ class ComposeBox extends PureComponent<Props, State> {
onFocus={this.handleTopicFocus}
onBlur={this.handleTopicBlur}
onTouchStart={this.handleInputTouchStart}
value={topic}
/>
)}
<MultilineInput
Expand All @@ -340,7 +346,6 @@ class ComposeBox extends PureComponent<Props, State> {
messageInputRef(component);
}
}}
value={message}
onBlur={this.handleMessageBlur}
onChange={this.handleMessageChange}
onFocus={this.handleMessageFocus}
Expand Down

0 comments on commit 4e8e6d0

Please sign in to comment.