Skip to content

Commit 1cc009f

Browse files
GniLudioJ-Sek
andauthored
fix(VVirtualScroll): scroll to last element (#22166)
Co-authored-by: J-Sek <[email protected]> fixes #20931
1 parent 1b021d3 commit 1cc009f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/vuetify/src/composables/virtual.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function useVirtual <T> (props: VirtualProps, items: Ref<readonly T[]>) {
8888
const start = performance.now()
8989
offsets[0] = 0
9090
const length = items.value.length
91-
for (let i = 1; i <= length - 1; i++) {
91+
for (let i = 1; i <= length; i++) {
9292
offsets[i] = (offsets[i - 1] || 0) + getSize(i - 1)
9393
}
9494
updateTime.value = Math.max(updateTime.value, performance.now() - start)
@@ -131,7 +131,7 @@ export function useVirtual <T> (props: VirtualProps, items: Ref<readonly T[]>) {
131131
}
132132

133133
function calculateOffset (index: number) {
134-
index = clamp(index, 0, items.value.length - 1)
134+
index = clamp(index, 0, items.value.length)
135135
const whole = Math.floor(index)
136136
const fraction = index % 1
137137
const next = whole + 1

0 commit comments

Comments
 (0)