1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-21 06:31:28 +02:00

fix flush change logic to not stack flushes (#1324)

This commit is contained in:
Ian Storm Taylor
2017-10-28 15:29:01 -07:00
committed by GitHub
parent c547a24afb
commit 5afcdd3c97

View File

@@ -181,10 +181,11 @@ class Editor extends React.Component {
flushChange = () => { flushChange = () => {
const { change } = this.tmp const { change } = this.tmp
if (change) { if (change && !this.tmp.flushTimeout) {
debug('flushChange', { change }) debug('flushChange', { change })
window.requestAnimationFrame(() => { this.tmp.flushTimeout = setTimeout(() => {
delete this.tmp.change delete this.tmp.change
delete this.tmp.flushTimeout
this.props.onChange(change) this.props.onChange(change)
}) })
} }