Remove shouldComponentUpdate from MarkdownVisComponent, as it is causing (#21501) (#21583)

This commit is contained in:
Chris Davies 2018-08-02 09:19:46 -04:00 committed by GitHub
parent 147612a552
commit 4065549d1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,29 +6,6 @@ import { Markdown } from 'ui/markdown/markdown';
*/
class MarkdownVisComponent extends Component {
/**
* This method will be called when props or the state has been updated, and
* we should return whether we want the render method to be called again (true)
* or if we know that the render method wouldn't produce anything different and
* we don't need it to be called (false).
*
* We only need to render if one of the parameters used in the render function
* actually changed. So we prevent calling render if none of it changed.
*/
shouldComponentUpdate(props) {
const shouldUpdate = props.fontSize !== this.props.fontSize ||
props.openLinksInNewTab !== this.props.openLinksInNewTab ||
props.markdown !== this.props.markdown;
// If we won't update, we need to trigger the renderComplete method here,
// since we will never render and thus never get to componentDidUpdate.
if (!shouldUpdate) {
this.props.renderComplete();
}
return shouldUpdate;
}
/**
* Will be called after the first render when the component is present in the DOM.
*