Skip to content

Commit

Permalink
fix: totalSize should be paddingStart + paddingEnd when size is…
Browse files Browse the repository at this point in the history
… 0 (#238)
  • Loading branch information
meowtec authored Jan 21, 2022
1 parent bc21ad1 commit 5300e47
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function useVirtual({
return measurements
}, [estimateSize, measuredCache, paddingStart, size, keyExtractor])

const totalSize = (measurements[size - 1]?.end || 0) + paddingEnd
const totalSize = (measurements[size - 1]?.end || paddingStart) + paddingEnd

latestRef.current.measurements = measurements
latestRef.current.totalSize = totalSize
Expand Down

1 comment on commit 5300e47

@vercel
Copy link

@vercel vercel bot commented on 5300e47 Jan 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.