From e65087e8d1887646875c0a6a217ef29aa575d542 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 25 Feb 2018 22:50:50 -0800 Subject: [PATCH] more perf improvements --- routes/_components/compose/LiteComposeBox.html | 14 +++++++------- .../virtualList/VirtualListContainer.html | 8 +++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/routes/_components/compose/LiteComposeBox.html b/routes/_components/compose/LiteComposeBox.html index ae904f0f..cc089319 100644 --- a/routes/_components/compose/LiteComposeBox.html +++ b/routes/_components/compose/LiteComposeBox.html @@ -153,8 +153,14 @@ export default { oncreate() { 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 => { let inputTextInCompose = this.store.get('inputTextInCompose') let currentInstance = this.store.get('currentInstance') @@ -163,12 +169,6 @@ saveText() }, {init: false}) - requestAnimationFrame(() => { - mark('autosize()') - autosize(this.refs.textarea) - stop('autosize()') - }) - // Avoid input delays by updating these values after a rAF this.observe('inputLengthToDisplay', inputLengthToDisplay => { requestAnimationFrame(() => { diff --git a/routes/_components/virtualList/VirtualListContainer.html b/routes/_components/virtualList/VirtualListContainer.html index 732dc283..d78cf746 100644 --- a/routes/_components/virtualList/VirtualListContainer.html +++ b/routes/_components/virtualList/VirtualListContainer.html @@ -29,9 +29,11 @@ } }) } else { - this.store.setForRealm({ - scrollHeight: node.scrollHeight, - offsetHeight: node.offsetHeight + requestAnimationFrame(() => { + this.store.setForRealm({ + scrollHeight: node.scrollHeight, + offsetHeight: node.offsetHeight + }) }) } stop('onCreate VirtualListContainer')