use rIC to keep scrolling smooth

This commit is contained in:
Nolan Lawson 2018-03-15 10:00:51 -07:00
parent f137f0c56c
commit fc8554bed3
2 changed files with 4 additions and 2 deletions

View File

@ -14,6 +14,7 @@
<script> <script>
import PseudoVirtualListItem from './PseudoVirtualListItem.html' import PseudoVirtualListItem from './PseudoVirtualListItem.html'
import { mark, stop } from '../../_utils/marks' import { mark, stop } from '../../_utils/marks'
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
export default { export default {
async oncreate() { async oncreate() {
@ -23,7 +24,7 @@
let key = this.get('key') let key = this.get('key')
if (makeProps) { if (makeProps) {
let props = await makeProps(key) let props = await makeProps(key)
requestAnimationFrame(() => { // delay slightly to avoid slow scrolling scheduleIdleTask(() => { // delay to avoid slow scrolling
mark('PseudoVirtualListLazyItem set props') mark('PseudoVirtualListLazyItem set props')
this.set({props: props}) this.set({props: props})
stop('PseudoVirtualListLazyItem set props') stop('PseudoVirtualListLazyItem set props')

View File

@ -9,6 +9,7 @@
<script> <script>
import VirtualListItem from './VirtualListItem' import VirtualListItem from './VirtualListItem'
import { mark, stop } from '../../_utils/marks' import { mark, stop } from '../../_utils/marks'
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
export default { export default {
async oncreate() { async oncreate() {
@ -18,7 +19,7 @@
let key = this.get('key') let key = this.get('key')
if (makeProps) { if (makeProps) {
let props = await makeProps(key) let props = await makeProps(key)
requestAnimationFrame(() => { // delay slightly to avoid slow scrolling scheduleIdleTask(() => { // delay to avoid slow scrolling
mark('VirtualListLazyItem set props') mark('VirtualListLazyItem set props')
this.set({props: props}) this.set({props: props})
stop('VirtualListLazyItem set props') stop('VirtualListLazyItem set props')