This commit is contained in:
Henry Jameson 2026-09-08 17:56:18 +03:00
commit 0411bc8f47

View file

@ -261,21 +261,10 @@ export default {
// # Virtual scrolling stuff // # Virtual scrolling stuff
const body = useTemplateRef('body') const body = useTemplateRef('body')
const { virtualHidden } = toRefs(props)
const virtualHeight = ref(120) const virtualHeight = ref(120)
const hiddenStyle = computed(() => ({ const hiddenStyle = computed(() => ({
height: this.virtualHeight + 'px', height: this.virtualHeight + 'px',
})) }))
const unsuspendibleIds = ref(new Set())
const suspendable = computed(() => unsuspendibleIds.value.size === 0)
const hide = computed(() => virtualHidden.value && suspendable.value)
const onStatusSuspendStateChange = ({ id, suspend }) => {
if (!suspend) {
unsuspendibleIds.value.add(id)
} else {
unsuspendibleIds.value.delete(id)
}
}
const updateVirtualHeight = () => { const updateVirtualHeight = () => {
if (hide) return // no updates when not rendering if (hide) return // no updates when not rendering
if (!status.value) return // not loaded yet if (!status.value) return // not loaded yet
@ -288,6 +277,19 @@ export default {
}) })
}) })
} }
const unsuspendibleIds = ref(new Set())
const suspendable = computed(() => unsuspendibleIds.value.size === 0)
const onStatusSuspendStateChange = ({ id, suspend }) => {
if (!suspend) {
unsuspendibleIds.value.add(id)
} else {
unsuspendibleIds.value.delete(id)
}
}
const { virtualHidden } = toRefs(props)
const hide = computed(() => virtualHidden.value && suspendable.value)
onMounted(() => { onMounted(() => {
updateVirtualHeight() updateVirtualHeight()
}) })