fix items rendered on top of other items

This commit is contained in:
Nolan Lawson 2018-03-01 09:19:45 -08:00
parent 840f391661
commit 71d0e4ddd1
2 changed files with 23 additions and 13 deletions

View file

@ -1,5 +1,4 @@
{{#await asyncProps}}
{{then props}}
{{#if props}}
<PseudoVirtualListItem :component
:props
:key
@ -11,15 +10,21 @@
:height
on:scrollToPosition
/>
{{/await}}
{{/if}}
<script>
import PseudoVirtualListItem from './PseudoVirtualListItem.html'
export default {
oncreate() {
// TODO: there appears to be a bug in {{#await}} that means we have to do this manually.
// Some items may appear on top of other items because their offset is 0 and never updated.
let makeProps = this.get('makeProps')
let key = this.get('key')
if (makeProps) {
makeProps(key).then(props => this.set({props: props}))
}
},
components: {
PseudoVirtualListItem
},
computed: {
asyncProps: async (makeProps, key) => makeProps && makeProps(key)
}
}
</script>

View file

@ -1,20 +1,25 @@
{{#await asyncProps}}
{{then props}}
{{#if props}}
<VirtualListItem :component
:offset
:props
:key
:index
/>
{{/await}}
{{/if}}
<script>
import VirtualListItem from './VirtualListItem'
export default {
oncreate() {
// TODO: there appears to be a bug in {{#await}} that means we have to do this manually.
// Some items may appear on top of other items because their offset is 0 and never updated.
let makeProps = this.get('makeProps')
let key = this.get('key')
if (makeProps) {
makeProps(key).then(props => this.set({props: props}))
}
},
components: {
VirtualListItem
},
computed: {
asyncProps: async (makeProps, key) => makeProps && makeProps(key)
}
}
</script>