From b15ad4b2f7dc2657414fa8355006bf7be55ee30f Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Tue, 23 Jan 2018 18:19:03 -0800 Subject: [PATCH] simplify virtual list even more --- routes/_components/Timeline.html | 7 +------ routes/_components/VirtualList.html | 8 ++++---- routes/_utils/virtualListStore.js | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/routes/_components/Timeline.html b/routes/_components/Timeline.html index bf59344..9e10466 100644 --- a/routes/_components/Timeline.html +++ b/routes/_components/Timeline.html @@ -2,7 +2,7 @@
(statusId) => database.getStatus($currentInstance, statusId), - items: (statusIds) => { - return statusIds.map(statusId => ({ - key: statusId - })) - }, lastStatusId: (statusIds) => statusIds.length && statusIds[statusIds.length - 1], label: (timeline, $currentInstance) => { if (timelines[timeline]) { diff --git a/routes/_components/VirtualList.html b/routes/_components/VirtualList.html index fcc694a..025fe33 100644 --- a/routes/_components/VirtualList.html +++ b/routes/_components/VirtualList.html @@ -1,11 +1,11 @@
- {{#each $visibleItems as item @key}} + {{#each $visibleItems as visibleItem @key}} {{/each}} {{#if $showFooter}} diff --git a/routes/_utils/virtualListStore.js b/routes/_utils/virtualListStore.js index 8d02c35..ef45cb3 100644 --- a/routes/_utils/virtualListStore.js +++ b/routes/_utils/virtualListStore.js @@ -56,7 +56,7 @@ virtualListStore.compute('visibleItems', let len = items.length let i = -1 while (++i < len) { - let { key } = items[i] + let key = items[i] let height = itemHeights[key] || 0 let currentOffset = totalOffset totalOffset += height @@ -87,7 +87,7 @@ virtualListStore.compute('heightWithoutFooter', let i = -1 let len = items.length while (++i < len) { - sum += itemHeights[items[i].key] || 0 + sum += itemHeights[items[i]] || 0 } return sum })