Skip to content

Commit

Permalink
fix: return empty list when size is 0 (#53)
Browse files Browse the repository at this point in the history
Fixes #52
  • Loading branch information
mogelbrod authored Aug 26, 2020
1 parent 9e5e06c commit 856100a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ export function useVirtual({

const virtualItems = React.useMemo(() => {
const virtualItems = []
const end = Math.min(range.end, measurements.length - 1)

for (let i = range.start; i <= range.end; i++) {
for (let i = range.start; i <= end; i++) {
const measurement = measurements[i]

const item = {
Expand Down

0 comments on commit 856100a

Please sign in to comment.