more perf improvements

This commit is contained in:
Nolan Lawson 2018-02-25 22:50:50 -08:00
parent 96303583ad
commit e65087e8d1
2 changed files with 12 additions and 10 deletions

View File

@ -153,8 +153,14 @@
export default { export default {
oncreate() { oncreate() {
this.set({inputText: store.get('currentInputTextInCompose')}) this.set({inputText: store.get('currentInputTextInCompose')})
const saveText = debounce(() => scheduleIdleTask(() => this.store.save()), 1000)
requestAnimationFrame(() => {
mark('autosize()')
autosize(this.refs.textarea)
stop('autosize()')
})
const saveText = debounce(() => scheduleIdleTask(() => this.store.save()), 1000)
this.observe('inputText', inputText => { this.observe('inputText', inputText => {
let inputTextInCompose = this.store.get('inputTextInCompose') let inputTextInCompose = this.store.get('inputTextInCompose')
let currentInstance = this.store.get('currentInstance') let currentInstance = this.store.get('currentInstance')
@ -163,12 +169,6 @@
saveText() saveText()
}, {init: false}) }, {init: false})
requestAnimationFrame(() => {
mark('autosize()')
autosize(this.refs.textarea)
stop('autosize()')
})
// Avoid input delays by updating these values after a rAF // Avoid input delays by updating these values after a rAF
this.observe('inputLengthToDisplay', inputLengthToDisplay => { this.observe('inputLengthToDisplay', inputLengthToDisplay => {
requestAnimationFrame(() => { requestAnimationFrame(() => {

View File

@ -29,9 +29,11 @@
} }
}) })
} else { } else {
this.store.setForRealm({ requestAnimationFrame(() => {
scrollHeight: node.scrollHeight, this.store.setForRealm({
offsetHeight: node.offsetHeight scrollHeight: node.scrollHeight,
offsetHeight: node.offsetHeight
})
}) })
} }
stop('onCreate VirtualListContainer') stop('onCreate VirtualListContainer')