From 2db30856f932d33974f32db434b95e4907b9234b Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Wed, 14 Mar 2018 18:38:26 -0700 Subject: [PATCH] fix bug where large items might not be rendered when scrolling up --- routes/_components/virtualList/virtualListStore.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/routes/_components/virtualList/virtualListStore.js b/routes/_components/virtualList/virtualListStore.js index b8772bb..319866f 100644 --- a/routes/_components/virtualList/virtualListStore.js +++ b/routes/_components/virtualList/virtualListStore.js @@ -40,14 +40,14 @@ virtualListStore.compute('rawVisibleItems', let height = itemHeights[key] || 0 let currentOffset = totalOffset totalOffset += height - let isBelowViewport = (currentOffset < scrollTop) - if (isBelowViewport) { - if (scrollTop - renderBuffer > currentOffset) { - continue // below the area we want to render + let isAboveViewport = (currentOffset < scrollTop) + if (isAboveViewport) { + if ((scrollTop - height - renderBuffer) > currentOffset) { + continue // above the area we want to render } } else { if (currentOffset > (scrollTop + height + renderBuffer)) { - break // above the area we want to render + break // below the area we want to render } } visibleItems.push({