fix null in virtual list item (#260)

This commit is contained in:
Nolan Lawson 2018-05-03 20:41:55 -07:00 committed by GitHub
parent 1f51cfd2eb
commit b1a3be06ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -30,9 +30,13 @@
export default { export default {
oncreate () { oncreate () {
let { key } = this.get() let { key } = this.get()
let node = this.refs.node
requestAnimationFrame(() => { requestAnimationFrame(() => {
if (!node || !key) {
return
}
mark('VirtualListItem gBCR') mark('VirtualListItem gBCR')
let rect = this.refs.node.getBoundingClientRect() let rect = node.getBoundingClientRect()
stop('VirtualListItem gBCR') stop('VirtualListItem gBCR')
// update all item heights in one batch for better perf // update all item heights in one batch for better perf
this.store.batchUpdateForRealm('itemHeights', key, rect.height) this.store.batchUpdateForRealm('itemHeights', key, rect.height)