Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions pages/posts/[domain].vue
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@
const virtualRows = computed(() => rowVirtualizer.value.getVirtualItems())

const totalSize = computed(() => rowVirtualizer.value.getTotalSize())
const virtualItemEls: Ref<(HTMLElement | null)[]> = shallowRef([])

// Next page loader
watchEffect(() => {
Expand Down Expand Up @@ -636,8 +637,10 @@
})

// FIX: Remove when this issue is fixed - https://github.com/TanStack/virtual/issues/619#issuecomment-1969516091
const measureElement = (el) => {
nextTick(() => {
const measureAll = () => {
rowVirtualizer.value.measureElement(null)

virtualItemEls.value.forEach((el) => {
if (!el) {
return
}
Expand All @@ -646,6 +649,14 @@
})
}

onMounted(() => {
measureAll()
})

onUpdated(() => {
measureAll()
})

/**
* SEO
*/
Expand Down Expand Up @@ -1009,7 +1020,7 @@
<li
v-for="virtualRow in virtualRows"
:key="virtualRow.key"
:ref="measureElement"
ref="virtualItemEls"
:data-index="virtualRow.index"
>
<!-- Next Pagination -->
Expand Down
17 changes: 14 additions & 3 deletions pages/premium/saved-posts/[domain].vue
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@
const virtualRows = computed(() => rowVirtualizer.value.getVirtualItems())

const totalSize = computed(() => rowVirtualizer.value.getTotalSize())
const virtualItemEls: Ref<(HTMLElement | null)[]> = shallowRef([])

// Next page loader
watchEffect(() => {
Expand Down Expand Up @@ -538,8 +539,10 @@
})

// FIX: Remove when this issue is fixed - https://github.com/TanStack/virtual/issues/619#issuecomment-1969516091
const measureElement = (el) => {
nextTick(() => {
const measureAll = () => {
rowVirtualizer.value.measureElement(null)

virtualItemEls.value.forEach((el) => {
if (!el) {
return
}
Expand All @@ -548,6 +551,14 @@
})
}

onMounted(() => {
measureAll()
})

onUpdated(() => {
measureAll()
})

/**
* SEO
*/
Expand Down Expand Up @@ -805,7 +816,7 @@
<li
v-for="virtualRow in virtualRows"
:key="virtualRow.key"
:ref="measureElement"
ref="virtualItemEls"
:data-index="virtualRow.index"
>
<!-- Next Pagination -->
Expand Down