From 1d9b458e7482963846cd83b2f4aeaa8c7bdc9b58 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 9 Sep 2026 20:35:51 +0300 Subject: [PATCH 1/8] changelog --- changelog.d/virtual-scrolling-2.change | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/virtual-scrolling-2.change diff --git a/changelog.d/virtual-scrolling-2.change b/changelog.d/virtual-scrolling-2.change new file mode 100644 index 000000000..74a47c6a9 --- /dev/null +++ b/changelog.d/virtual-scrolling-2.change @@ -0,0 +1 @@ +Implemented new virtual scrolling. Opening huge threads should be faster now From 56c4c29bd7be790e75bb2a9675c5ff1f5e895138 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 10 Sep 2026 16:15:19 +0300 Subject: [PATCH 2/8] make useVirtualScrolling agnostic --- src/components/conversation/conversation.js | 57 +++++-- src/components/conversation/conversation.vue | 22 +-- src/composables/useVirtualScrolling.js | 163 ++++++++----------- 3 files changed, 120 insertions(+), 122 deletions(-) diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 1fed4c458..316a33bb7 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -187,6 +187,27 @@ export default { '-last': status.id === lastStatus.value?.id, }) + // Getting the actual font size in pixels since UI might have + // a different scale + const fontSizeSetting = computed(() => mergedConfig.value.textSize) + const fontSize = ref(0) + const updateFontSize = () => { + const string = window + .getComputedStyle(document.body) + .getPropertyValue('font-size') + fontSize.value = Number.parseInt(string.slice(0, -2), 10) // remove the 'px' + } + // Update font size if user changed UI scale + watch(fontSizeSetting, updateFontSize, { immediate: true }) + + // Placeholder heights. + const mutedStatusHeight = computed(() => fontSize.value * 1.5) + const normalStatusHeight = computed(() => fontSize.value * 10) + const getPlaceholderHeight = (id) => + conversation.value.find((item) => item.id === id)?.muted + ? mutedStatusHeight + : normalStatusHeight + // # Linear style stuff const isLinearView = computed(() => displayStyle.value !== 'tree') const linearElement = useTemplateRef('linear') @@ -197,13 +218,14 @@ export default { heightChart: heightChartLinear, changeSuspendState: changeSuspendStateLinear, updateVirtualHeight: updateVirtualHeightLinear, - } = useVirtualScrolling( - conversation, - linearElement, - scroller, - linearScrollCompensation, - currentStatus, - ) + } = useVirtualScrolling({ + list: conversation, + body: linearElement, + scrollPositionInstance: scroller, + scrollCompensation: linearScrollCompensation, + anchorId: currentStatus.id, + getPlaceholderHeight, + }) // # Tree style stuff const isTreeView = computed(() => displayStyle.value === 'tree') @@ -224,12 +246,13 @@ export default { heightChart: heightChartAncestors, changeSuspendState: changeSuspendStateAncestors, updateVirtualHeight: updateVirtualHeightAncestors, - } = useVirtualScrolling( - currentAncestors, - ancestorsElement, - scroller, - treeScrollCompensation, - ) + } = useVirtualScrolling({ + list: currentAncestors, + body: ancestorsElement, + scrollPositionInstance: scroller, + scrollCompensation: treeScrollCompensation, + getPlaceholderHeight, + }) const currentLevel = computed(() => [currentStatus.value].filter(Boolean)) const currentLevelElement = useTemplateRef('currentLevel') @@ -237,7 +260,13 @@ export default { heightChart: heightChartCurrentLevel, changeSuspendState: changeSuspendStateCurrentLevel, updateVirtualHeight: updateVirtualHeightCurrentLevel, - } = useVirtualScrolling(currentLevel, currentLevelElement, scroller, false) + } = useVirtualScrolling({ + list: currentLevel, + body: currentLevelElement, + scrollPositionInstance: scroller, + scrollCompensation: false, + getPlaceholderHeight, + }) const treeViewIsSimple = computed( () => !mergedConfig.value.conversationTreeAdvanced, diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue index 3a61decf5..744fea0fd 100644 --- a/src/components/conversation/conversation.vue +++ b/src/components/conversation/conversation.vue @@ -99,17 +99,17 @@ @@ -128,7 +128,7 @@