mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-16 03:06:27 +00:00
debounce dispatch
This commit is contained in:
@@ -89,8 +89,9 @@ class MarkdownNoteDetail extends React.Component {
|
||||
}
|
||||
|
||||
save () {
|
||||
clearTimeout(this.saveQueue)
|
||||
this.saveQueue = setTimeout(() => {
|
||||
let { note, dispatch } = this.props
|
||||
|
||||
dispatch({
|
||||
type: 'UPDATE_NOTE',
|
||||
note: this.state.note
|
||||
@@ -98,6 +99,7 @@ class MarkdownNoteDetail extends React.Component {
|
||||
|
||||
dataApi
|
||||
.updateNote(note.storage, note.folder, note.key, this.state.note)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
handleFolderChange (e) {
|
||||
|
||||
@@ -99,8 +99,9 @@ class SnippetNoteDetail extends React.Component {
|
||||
}
|
||||
|
||||
save () {
|
||||
clearTimeout(this.saveQueue)
|
||||
this.saveQueue = setTimeout(() => {
|
||||
let { note, dispatch } = this.props
|
||||
|
||||
dispatch({
|
||||
type: 'UPDATE_NOTE',
|
||||
note: this.state.note
|
||||
@@ -108,6 +109,7 @@ class SnippetNoteDetail extends React.Component {
|
||||
|
||||
dataApi
|
||||
.updateNote(note.storage, note.folder, note.key, this.state.note)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
handleFolderChange (e) {
|
||||
|
||||
Reference in New Issue
Block a user