Skip to content

Commit 0db622a

Browse files
committed
fix(ChatMessages): ensure content is render before scrolling
1 parent b052bb5 commit 0db622a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/runtime/components/ChatMessages.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,15 @@ onMounted(() => {
238238
return
239239
}
240240
241-
if (props.shouldScrollToBottom) {
242-
// Scroll to bottom on mount without smooth animation when `props.shouldScrollToBottom` is true
243-
nextTick(() => scrollToBottom(false))
244-
} else {
245-
checkScrollPosition()
246-
}
241+
// Wait for content to fully render (especially MDC components in ChatPalette)
242+
setTimeout(() => {
243+
if (props.shouldScrollToBottom) {
244+
// Scroll to bottom on mount without smooth animation when `props.shouldScrollToBottom` is true
245+
scrollToBottom(false)
246+
} else {
247+
checkScrollPosition()
248+
}
249+
}, 100)
247250
248251
// Add event listener to check scroll position to show the auto scroll button
249252
useEventListener(parent, 'scroll', checkScrollPosition)

0 commit comments

Comments
 (0)