@@ -268,15 +268,17 @@ onMounted(() => {
|
268 | 268 | |
269 | 269 | lastScrollTop.value = parent.value.scrollTop |
270 | 270 | |
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(() => { |
275 | 275 | scrollToBottom(false) |
276 | | - } else { |
| 276 | + }, 100) |
| 277 | + } else { |
| 278 | + nextTick(() => { |
277 | 279 | checkScrollPosition() |
278 | | - } |
279 | | - }, 100) |
| 280 | + }) |
| 281 | + } |
280 | 282 | |
281 | 283 | // Add event listener to check scroll position to show the auto scroll button |
282 | 284 | useEventListener(parent, 'scroll', checkScrollPosition) |
|