remove unnecessary item wrapping (#254)

* remove unnecessary item wrapping

* fix lint
This commit is contained in:
Nolan Lawson 2018-05-01 21:05:15 -07:00 committed by GitHub
parent 82a4309454
commit ffa5dcb3ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -1,15 +1,15 @@
<div class="pseudo-virtual-list" on:initialized ref:node>
{#each wrappedItems as wrappedItem, i (wrappedItem.item)}
{#each safeItems as item, i (item)}
<PseudoVirtualListLazyItem
{component}
index={i}
length={wrappedItems.length}
length={safeItems.length}
{makeProps}
key={wrappedItem.item}
key={item}
{intersectionObserver}
isIntersecting={isIntersecting(wrappedItem.item, $intersectionStates)}
isCached={isCached(wrappedItem.item, $intersectionStates)}
height={getHeight(wrappedItem.item, $intersectionStates)}
isIntersecting={isIntersecting(item, $intersectionStates)}
isCached={isCached(item, $intersectionStates)}
height={getHeight(item, $intersectionStates)}
/>
{/each}
</div>
@ -110,7 +110,7 @@
}
},
computed: {
wrappedItems: ({ items }) => items ? items.map(item => ({item})) : [],
safeItems: ({ items }) => items || [],
allItemsHaveHeight: ({ items, $intersectionStates }) => {
if (!items) {
return false