From 7d6e6a1727538f6f06d15cd76f3812836d02e0c0 Mon Sep 17 00:00:00 2001 From: Jay Shenk Date: Mon, 14 May 2018 21:17:35 -0400 Subject: [PATCH] Use withSafeTimeout HOC for setTimeout --- editor/components/rich-text/inline-blocks.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editor/components/rich-text/inline-blocks.js b/editor/components/rich-text/inline-blocks.js index ed3d4e267d986..863c0e88bd4de 100644 --- a/editor/components/rich-text/inline-blocks.js +++ b/editor/components/rich-text/inline-blocks.js @@ -3,6 +3,7 @@ */ import { Component, Fragment, compose } from '@wordpress/element'; import { withSelect, withDispatch } from '@wordpress/data'; +import { withSafeTimeout } from '@wordpress/components'; /** * Internal dependencies @@ -22,10 +23,12 @@ class InlineBlocks extends Component { } componentDidMount() { + const { setTimeout, setInsertAvailable } = this.props; + // When moving between two different RichText with the keyboard, we need to // make sure `setInsertAvailable` is called after `setInsertUnavailable` // from previous RichText so that editor state is correct - setTimeout( this.props.setInsertAvailable ); + setTimeout( setInsertAvailable ); } componentDidUpdate( prevProps ) { @@ -132,4 +135,5 @@ export default compose( [ completeInsert: completeInlineInsert, }; } ), + withSafeTimeout, ] )( InlineBlocks );