Skip to content

Commit

Permalink
fix markdown widget re-rendering on load
Browse files Browse the repository at this point in the history
  • Loading branch information
erquhart committed Dec 21, 2017
1 parent 843503e commit a48cabf
Showing 1 changed file with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,7 @@ export default class Editor extends Component {
}

shouldComponentUpdate(nextProps, nextState) {
return (this.props.value !== null && nextProps.value === null)
|| (this.props.value === null && nextProps.value !== null)
|| !this.state.value.equals(nextState.value);
}

componentWillUpdate(nextProps) {
const shouldResetState = (this.props.value !== null && nextProps.value === null)
|| (this.props.value === null && nextProps.value !== null)
if (shouldResetState) {
this.setState({ value: createSlateValue(nextProps.value) });
}
return !this.state.value.equals(nextState.value);
}

handlePaste = (e, data, change) => {
Expand Down

0 comments on commit a48cabf

Please sign in to comment.