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:
@@ -181,10 +181,11 @@ class Editor extends React.Component {
|
||||
flushChange = () => {
|
||||
const { change } = this.tmp
|
||||
|
||||
if (change) {
|
||||
if (change && !this.tmp.flushTimeout) {
|
||||
debug('flushChange', { change })
|
||||
window.requestAnimationFrame(() => {
|
||||
this.tmp.flushTimeout = setTimeout(() => {
|
||||
delete this.tmp.change
|
||||
delete this.tmp.flushTimeout
|
||||
this.props.onChange(change)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user