diff --git a/packages/slate-react/src/components/editor.js b/packages/slate-react/src/components/editor.js index 018e35f64..e656eec23 100644 --- a/packages/slate-react/src/components/editor.js +++ b/packages/slate-react/src/components/editor.js @@ -157,17 +157,6 @@ class Editor extends React.Component { this.flushChange() } - /** - * When the component unmounts, clear flushTimeout if it has been set - * to avoid calling onChange after unmount. - */ - - componentWillUnmount = () => { - if (this.tmp.flushTimeout) { - clearTimeout(this.tmp.flushTimeout) - } - } - /** * Queue a `change` object, to be able to flush it later. This is required for * when a change needs to be applied to the value, but because of the React @@ -192,13 +181,10 @@ class Editor extends React.Component { flushChange = () => { const { change } = this.tmp - if (change && !this.tmp.flushTimeout) { + if (change) { debug('flushChange', { change }) - this.tmp.flushTimeout = setTimeout(() => { - delete this.tmp.change - delete this.tmp.flushTimeout - this.props.onChange(change) - }) + delete this.tmp.change + this.props.onChange(change) } }