From da1f20595c83628384151c6914956e2a84ad5cf8 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 25 Feb 2018 16:47:45 -0800 Subject: [PATCH] improve perf of autosize --- routes/_components/compose/LiteComposeBox.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/routes/_components/compose/LiteComposeBox.html b/routes/_components/compose/LiteComposeBox.html index 401116d..f0347d1 100644 --- a/routes/_components/compose/LiteComposeBox.html +++ b/routes/_components/compose/LiteComposeBox.html @@ -105,12 +105,14 @@ import autosize from 'autosize' import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' import debounce from 'lodash/debounce' + import { mark, stop } from '../../_utils/marks' export default { oncreate() { - autosize(this.refs.textarea) this.set({inputText: store.get('currentInputTextInCompose')}) - autosize.update(this.refs.textarea) + mark('autosize()') + autosize(this.refs.textarea) // TODO: this layout thrashes, could maybe find a better design + stop('autosize()') const saveText = debounce(() => scheduleIdleTask(() => this.store.save()), 1000) @@ -123,7 +125,9 @@ }, {init: false}) }, ondestroy() { + mark('autosize.destroy()') autosize.destroy(this.refs.textarea) + stop('autosize.destroy()') }, data: () => ({ inputText: ''