GitHub

Original file line numberDiff line numberDiff line change

@@ -268,15 +268,17 @@ onMounted(() => {

268268
269269

lastScrollTop.value = parent.value.scrollTop

270270
271-

// Wait for content to fully render (especially MDC components in ChatPalette)

272-

setTimeout(() => {

273-

if (props.shouldScrollToBottom) {

274-

// Scroll to bottom on mount without smooth animation when `props.shouldScrollToBottom` is true

271+

if (props.shouldScrollToBottom) {

272+

// Scroll to bottom immediately to avoid flash, then again after a delay to account for async content (e.g. MDC)

273+

scrollToBottom(false)

274+

setTimeout(() => {

275275

scrollToBottom(false)

276-

} else {

276+

}, 100)

277+

} else {

278+

nextTick(() => {

277279

checkScrollPosition()

278-

}

279-

}, 100)

280+

})

281+

}

280282
281283

// Add event listener to check scroll position to show the auto scroll button

282284

useEventListener(parent, 'scroll', checkScrollPosition)

Read the original on github.com ↗