forked from cybrespace/pinafore
dial back rIC usage, fix virtualListStore calculations
This commit is contained in:
parent
72e7e18e0b
commit
d2834d3bb2
|
@ -23,11 +23,9 @@
|
||||||
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
|
|
||||||
mark('PseudoVirtualListLazyItem set props')
|
mark('PseudoVirtualListLazyItem set props')
|
||||||
this.set({props: props})
|
this.set({props: props})
|
||||||
stop('PseudoVirtualListLazyItem set props')
|
stop('PseudoVirtualListLazyItem set props')
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
<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() {
|
||||||
|
@ -19,11 +18,9 @@
|
||||||
let key = this.get('key')
|
let key = this.get('key')
|
||||||
if (makeProps) {
|
if (makeProps) {
|
||||||
let props = await makeProps(key)
|
let props = await makeProps(key)
|
||||||
scheduleIdleTask(() => { // delay slightly 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')
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { mark, stop } from '../../_utils/marks'
|
||||||
import { RealmStore } from '../../_utils/RealmStore'
|
import { RealmStore } from '../../_utils/RealmStore'
|
||||||
import { reselect } from '../../_utils/reselect'
|
import { reselect } from '../../_utils/reselect'
|
||||||
|
|
||||||
const VIEWPORT_RENDER_FACTOR = 5
|
const RENDER_BUFFER_FACTOR = 1.5
|
||||||
|
|
||||||
class VirtualListStore extends RealmStore {
|
class VirtualListStore extends RealmStore {
|
||||||
constructor (state) {
|
constructor (state) {
|
||||||
|
@ -30,7 +30,7 @@ virtualListStore.compute('rawVisibleItems',
|
||||||
if (!items) {
|
if (!items) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
let renderBuffer = VIEWPORT_RENDER_FACTOR * offsetHeight
|
let renderBuffer = RENDER_BUFFER_FACTOR * offsetHeight
|
||||||
let visibleItems = []
|
let visibleItems = []
|
||||||
let totalOffset = showHeader ? headerHeight : 0
|
let totalOffset = showHeader ? headerHeight : 0
|
||||||
let len = items.length
|
let len = items.length
|
||||||
|
@ -46,7 +46,7 @@ virtualListStore.compute('rawVisibleItems',
|
||||||
continue // above the area we want to render
|
continue // above the area we want to render
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (currentOffset > (scrollTop + height + renderBuffer)) {
|
if (currentOffset > (scrollTop + offsetHeight + renderBuffer)) {
|
||||||
break // below the area we want to render
|
break // below the area we want to render
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue