From 9c8923a4db22ceda7aa42d2ff170badb91fa2894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20Van=C2=A0Dorpe?= Date: Thu, 1 Nov 2018 18:28:28 +0100 Subject: [PATCH] Remove deprecated componentWillReceiveProps from TinyMCE component (#11368) --- .../editor/src/components/rich-text/tinymce.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/editor/src/components/rich-text/tinymce.js b/packages/editor/src/components/rich-text/tinymce.js index d2a300a8d9cdb..4e6ab5c17562b 100644 --- a/packages/editor/src/components/rich-text/tinymce.js +++ b/packages/editor/src/components/rich-text/tinymce.js @@ -130,15 +130,7 @@ export default class TinyMCE extends Component { this.initialize(); } - shouldComponentUpdate() { - // We must prevent rerenders because TinyMCE will modify the DOM, thus - // breaking React's ability to reconcile changes. - // - // See: https://github.com/facebook/react/issues/6802 - return false; - } - - componentWillReceiveProps( nextProps ) { + shouldComponentUpdate( nextProps ) { this.configureIsPlaceholderVisible( nextProps.isPlaceholderVisible ); if ( ! isEqual( this.props.style, nextProps.style ) ) { @@ -155,6 +147,12 @@ export default class TinyMCE extends Component { this.editorNode.removeAttribute( key ) ); updatedKeys.forEach( ( key ) => this.editorNode.setAttribute( key, nextProps[ key ] ) ); + + // We must prevent rerenders because TinyMCE will modify the DOM, thus + // breaking React's ability to reconcile changes. + // + // See: https://github.com/facebook/react/issues/6802 + return false; } componentWillUnmount() {