Spaces:
Sleeping
Sleeping
Fix auto-scroll issue with message streaming in Svelte 5 (#1790)
Browse files* Fix auto-scroll issue with message streaming in Svelte 5
In Svelte 5, actions only update when the bound value changes by reference.
Previously, snapScrollToBottom was bound to `messages`, which didn't trigger updates
when only the content of a message changed during streaming.
Updated binding to `messages.map(message => message.content)` to ensure the action reacts
to content changes, restoring expected scroll behavior.
* fix: lint
---------
Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>
src/lib/components/chat/ChatWindow.svelte
CHANGED
|
@@ -248,7 +248,7 @@
|
|
| 248 |
<div class="relative min-h-0 min-w-0">
|
| 249 |
<div
|
| 250 |
class="scrollbar-custom h-full overflow-y-auto"
|
| 251 |
-
use:snapScrollToBottom={messages.
|
| 252 |
bind:this={chatContainer}
|
| 253 |
>
|
| 254 |
<div
|
|
|
|
| 248 |
<div class="relative min-h-0 min-w-0">
|
| 249 |
<div
|
| 250 |
class="scrollbar-custom h-full overflow-y-auto"
|
| 251 |
+
use:snapScrollToBottom={messages.map((message) => message.content)}
|
| 252 |
bind:this={chatContainer}
|
| 253 |
>
|
| 254 |
<div
|