Skip to content

Commit 2f133f2

Browse files
waleedlatif1claude
andcommitted
fix(chat): re-attach scroll listener once container mounts
The scroll effect's empty dep array meant it ran only on the first render, when `chatConfig` is still loading and the component returns `<ChatLoadingState />` — so `messagesContainerRef.current` was null and the listener was never attached. Depend on the gating conditions that control which tree renders, so the effect re-runs once the real container is in the DOM (and re-attaches when toggling in/out of voice mode). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent fb0bc2c commit 2f133f2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/sim/app/chat/[identifier]/chat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export default function ChatClient({ identifier }: { identifier: string }) {
184184

185185
container.addEventListener('scroll', handleScroll, { passive: true })
186186
return () => container.removeEventListener('scroll', handleScroll)
187-
}, [])
187+
}, [chatConfig, isVoiceFirstMode, authRequired])
188188

189189
useEffect(() => {
190190
if (isStreamingResponse) {

0 commit comments

Comments
 (0)