Skip to content

Commit

Permalink
fix(virtual-core): ensure getTotalSize returns 0 for empty list
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasweng committed Sep 13, 2024
1 parent 661a956 commit 5d1da8e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/virtual-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,10 @@ export class Virtualizer<
)
}

return end - this.options.scrollMargin + this.options.paddingEnd
return Math.max(
end - this.options.scrollMargin + this.options.paddingEnd,
0,
)
}

private _scrollToOffset = (
Expand Down

0 comments on commit 5d1da8e

Please sign in to comment.