1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

cancel dispatch queue before focrcing & shorter dispatch latency

This commit is contained in:
Dick Choi
2016-05-31 21:39:42 +09:00
parent eeda6b0208
commit 0c2226b3fc

View File

@@ -22,6 +22,7 @@ class NoteDetail extends React.Component {
componentWillReceiveProps (nextProps) { componentWillReceiveProps (nextProps) {
if (nextProps.note.key !== this.props.note.key) { if (nextProps.note.key !== this.props.note.key) {
if (this.state.isDispatchQueued) { if (this.state.isDispatchQueued) {
this.cancelDispatchQueue()
this.dispatch() this.dispatch()
} }
this.setState({ this.setState({
@@ -92,7 +93,7 @@ class NoteDetail extends React.Component {
this.setState({ this.setState({
isDispatchQueued: false isDispatchQueued: false
}) })
}, 500) }, 100)
} }
dispatch () { dispatch () {